def prompt_for_existing_session(self, sessions):
        """ Prompt user if they want to resume an old session
        (or their partners session) or create a new session.
        """
        if not sessions:
            return None
        print("Would you like to join a previous session or create a new session?")
        for index, session in enumerate(sessions):
            print(("{id} : {creator} started at {timestamp} ({hashid})"
                   .format(id=index+1, creator=session.get('creator'),
                           timestamp=session.get('created'), hashid=session.get('id'))))
        print("{new_id} : Create a new session with the current files?"
              .format(new_id=len(sessions)+1))
        desired = input("Type the number of the session you'd like to join: ")
        try:
            outcome = int(desired.strip())
        except:
            outcome = len(sessions)+1
            log.warning("Could not parse int for choice")

        if outcome >= len(sessions):
            log.info("Chose to start new session")
            return None
        else:
            log.info("Resuming session {}".format(outcome - 1))
            desired = sessions[outcome - 1]
            return session
def prompt_for_existing_session ( self , sessions ) : if not sessions : return None print ( "Would you like to join a previous session or create a new session?" ) for index , session in enumerate ( sessions ) : print ( ( "{id} : {creator} started at {timestamp} ({hashid})" . format ( id = index + 1 , creator = session . get ( 'creator' ) , timestamp = session . get ( 'created' ) , hashid = session . get ( 'id' ) ) ) ) print ( "{new_id} : Create a new session with the current files?" . format ( new_id = len ( sessions ) + 1 ) ) desired = input ( "Type the number of the session you'd like to join: " ) try : outcome = int ( desired . strip ( ) ) except : outcome = len ( sessions ) + 1 log . warning ( "Could not parse int for choice" ) if outcome >= len ( sessions ) : log . info ( "Chose to start new session" ) return None else : log . info ( "Resuming session {}" . format ( outcome - 1 ) ) desired = sessions [ outcome - 1 ] return session
Prompt user if they want to resume an old session
        (or their partners session) or create a new session.