def start_stuff(app, project=None): """ This function can be handed app and a project and do whatever is required. This allows it to be run by another script if required """ with pftextoutputs.PowerFactoryLogging( pf_app=app, add_handler=True, handler_level=logging.DEBUG, logger_to_use=logger, formatter=pftextoutputs.PFFormatter( '%(module)s: Line: %(lineno)d: %(message)s')) as pflogger: fault_level_summary_pia(app, project)
def start_stuff(app, project=None): """ This function can be handed app and a project and do whatever is required. This allows it to be run by another script if required """ with pftextoutputs.PowerFactoryLogging( pf_app=app, add_handler=True, handler_level=logging.DEBUG, logger_to_use=logger, formatter=pftextoutputs.PFFormatter( '%(module)s: Line: %(lineno)d: %(message)s' # format for printing stuff to the console )) as pflogger: create_voltage_diff_plot(app, project)
def main(app): with pftextoutputs.PowerFactoryLogging( pf_app=app, add_handler=True, handler_level=logging.DEBUG, formatter=pftextoutputs.PFFormatter( '%(module)s: %(funcName)s: Line: %(lineno)d: %(message)s'), ) as pflogger: app.PrintInfo(f'Manual Print using app not {logger}') logger.info(f'Manual Print using {logger}') active_project = app.GetActiveProject() if not active_project: logging.error('No Active Project, ' 'Script Stopped before it does anything') return current_script = app.GetCurrentScript() try: revert = current_script.add_reversion except AttributeError: revert = False if revert: add_reversion(app) try: max_elms = current_script.max_elms except AttributeError: max_elms = 10**100 logger.warning(f'{current_script} does not have a "max_elms"' f'attribute, assuming {max_elms}') find_undrawn_elements(app, max_elms) return