<s> import tweepy <EOL> import sys <EOL> import os <EOL> from webbrowser import open as site <EOL> import settings <EOL> keysPath = "<STR_LIT>" <EOL> if len ( sys . argv ) == <NUM_LIT:1> : <EOL> print ( "<STR_LIT>" ) <EOL> sys . exit ( ) <EOL> numbers = eval ( "<STR_LIT>" . join ( sys . argv [ <NUM_LIT:1> : ] ) ) <EOL> auth = tweepy . OAuthHandler ( settings . API_KEY , settings . API_SECRET ) <EOL> if os . path . exists ( keysPath ) : <EOL> keysFile = open ( keysPath , "<STR_LIT>" ) <EOL> else : <EOL> keysFile = open ( keysPath , "<STR_LIT>" ) <EOL> keysFile . seek ( <NUM_LIT:0> ) <EOL> if len ( keysFile . read ( ) ) == <NUM_LIT:0> : <EOL> authUrl = auth . get_authorization_url ( ) <EOL> site ( authUrl ) <EOL> authPIN = input ( "<STR_LIT>" ) <EOL> try : <EOL> auth . get_access_token ( str ( authPIN ) ) <EOL> except tweepy . TweepErrori as e : <EOL> print ( "<STR_LIT>" + e . message ) <EOL> sys . exit ( ) <EOL> keysFile . write ( auth . access_token + "<STR_LIT:U+0020>" + auth . access_token_secret ) <EOL> else : <EOL> keysFile . seek ( <NUM_LIT:0> ) <EOL> keys = keysFile . read ( ) . split ( "<STR_LIT:U+0020>" ) <EOL> if len ( keys ) == <NUM_LIT:2> : <EOL> auth . set_access_token ( keys [ <NUM_LIT:0> ] , keys [ <NUM_LIT:1> ] ) <EOL> else : <EOL> print ( "<STR_LIT>" , keysPath ) <EOL> sys . exit ( ) <EOL> api = tweepy . API ( auth ) <EOL> tweetID = api . update_status ( status = "<STR_LIT>" + str ( numbers ) ) . id <EOL> class ReplyListener ( tweepy . StreamListener ) : <EOL> def on_status ( self , status ) : <EOL> if status . in_reply_to_status_id == tweetID : <EOL> parsedNumbers = "<STR_LIT>" . join ( status . text . split ( "<STR_LIT:U+0020>" ) [ <NUM_LIT:1> : ] ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) . replace ( "<STR_LIT:[>" , "<STR_LIT>" ) . replace ( "<STR_LIT:]>" , "<STR_LIT>" ) . replace ( "<STR_LIT:(>" , "<STR_LIT>" ) . replace ( "<STR_LIT:)>" , "<STR_LIT>" ) . split ( "<STR_LIT:U+002C>" ) <EOL> givenNumbers = list ( map ( int , parsedNumbers ) ) <EOL> areSorted = True <EOL> if len ( givenNumbers ) != len ( numbers ) : <EOL> areSorted = False <EOL> for n in givenNumbers : <EOL> if givenNumbers . count ( n ) != numbers . count ( n ) : <EOL> areSorted = False <EOL> break <EOL> for i in range ( len ( givenNumbers ) ) : <EOL> if i > <NUM_LIT:0> : <EOL> if not givenNumbers [ i ] >= givenNumbers [ i - <NUM_LIT:1> ] : <EOL> areSorted = False <EOL> break <EOL> if areSorted : <EOL> print ( givenNumbers ) <EOL> api . update_status ( <EOL> "<STR_LIT:@>" + status . author . screen_name + "<STR_LIT>" , <EOL> in_reply_to_status_id = status . id ) <EOL> return False <EOL> else : <EOL> api . update_status ( <EOL> "<STR_LIT:@>" + status . author . screen_name + <EOL> "<STR_LIT>" , <EOL> in_reply_to_status_id = status . id ) <EOL> return True <EOL> else : <EOL> return True <EOL> def on_error ( self , statusCode ) : <EOL> print ( "<STR_LIT>" , statusCode ) <EOL> return True <EOL> def on_timeout ( self ) : <EOL> print ( "<STR_LIT>" ) <EOL> return True <EOL> listener = tweepy . streaming . Stream ( auth , ReplyListener ( ) ) <EOL> listener . filter ( track = [ "<STR_LIT:@>" + api . me ( ) . screen_name ] ) </s>
