<s> import sublime <EOL> class SnapshotListPanel ( object ) : <EOL> def __init__ ( self , window , client , repository ) : <EOL> self . window = window <EOL> self . client = client <EOL> self . repository = repository <EOL> self . choices = [ ] <EOL> def on_done ( self , index ) : <EOL> if index == - <NUM_LIT:1> : <EOL> return <EOL> self . callback ( <EOL> repository = self . repository , <EOL> snapshot = self . choices [ index ] [ <NUM_LIT:0> ] , <EOL> indices = self . choices [ index ] [ <NUM_LIT:1> ] . split ( "<STR_LIT:U+002C>" ) ) <EOL> def show ( self , callback ) : <EOL> self . callback = callback <EOL> options = dict ( <EOL> repository = self . repository , <EOL> snapshot = "<STR_LIT>" <EOL> ) <EOL> try : <EOL> response = self . client . snapshot . get ( ** options ) <EOL> except Exception as e : <EOL> return sublime . error_message ( "<STR_LIT>" . format ( e ) ) <EOL> self . choices = [ ] <EOL> for snapshot in response [ "<STR_LIT>" ] : <EOL> self . choices . append ( [ <EOL> snapshot [ "<STR_LIT>" ] , <EOL> "<STR_LIT:U+002C>" . join ( snapshot [ "<STR_LIT>" ] ) <EOL> ] ) <EOL> self . choices . sort ( reverse = True ) <EOL> self . window . show_quick_panel ( self . choices , self . on_done ) </s>
