def save_report(session):
    '''
    Saves the session to a temp file, and returns that path.
    Also prunes the number of reports to 10 so there aren't loads building up.
    '''
    # prune this folder to contain the last 10 sessions
    previous_reports = glob.glob(os.path.join(report_dir(), '*.pyireport'))
    previous_reports.sort(reverse=True)
    while len(previous_reports) > 10:
        report_file = previous_reports.pop()
        os.remove(report_file)

    identifier = time.strftime('%Y-%m-%dT%H-%M-%S', time.localtime(session.start_time))

    path = os.path.join(
        report_dir(),
        identifier + '.pyireport'
    )
    session.save(path)
    return path, identifier
def save_report ( session ) : previous_reports = glob . glob ( os . path . join ( report_dir ( ) , '*.pyireport' ) ) previous_reports . sort ( reverse = True ) while len ( previous_reports ) > 10 : report_file = previous_reports . pop ( ) os . remove ( report_file ) identifier = time . strftime ( '%Y-%m-%dT%H-%M-%S' , time . localtime ( session . start_time ) ) path = os . path . join ( report_dir ( ) , identifier + '.pyireport' ) session . save ( path ) return path , identifier
Saves the session to a temp file, and returns that path.
    Also prunes the number of reports to 10 so there aren't loads building up.