original_docstring: Provide the program's entry point when directly executed.
docstring: Provide the program's entry point when directly executed.
docstring_tokens: Provide the program ' s entry point when directly executed .
code: def request_login(reddit):
      """Provide the program's entry point when directly executed."""
      scopes = ['edit', 'history', 'identity',
                'mysubreddits', 'privatemessages', 'read', 'report',
                'save', 'submit', 'subscribe', 'vote']
      # scopes = ['creddits', 'edit', 'flair', 'history', 'identity',
      #           'modconfig', 'modcontributors', 'modflair', 'modlog',
      #           'modothers', 'modposts', 'modself', 'modwiki',
      #           'mysubreddits', 'privatemessages', 'read', 'report',
      #           'save', 'submit', 'subscribe', 'vote', 'wikiedit',
      #           'wikiread']
  
      state = str(random.randint(0, 65000))
      url = reddit.auth.url(scopes, state, 'permanent')
      webbrowser.open(url)
      sys.stdout.flush()
  
      client = receive_connection()
      data = client.recv(1024).decode('utf-8')
      param_tokens = data.split(' ', 2)[1].split('?', 1)[1].split('&')
      params = {key: value for (key, value) in [token.split('=')
                                                for token in param_tokens]}
  
      if state != params['state']:
          send_message(client, 'State mismatch. Expected: {} Received: {}'
                       .format(state, params['state']))
          return None
      elif 'error' in params:
          send_message(client, params['error'])
          return None
  
      refresh_token = reddit.auth.authorize(params['code'])
      send_message(client, 'Refresh token: {}; please close this window'.format(refresh_token))
      return refresh_token
code_tokens: def request_login ( reddit ) : scopes = [ 'edit' , 'history' , 'identity' , 'mysubreddits' , 'privatemessages' , 'read' , 'report' , 'save' , 'submit' , 'subscribe' , 'vote' ] state = str ( random . randint ( 0 , 65000 ) ) url = reddit . auth . url ( scopes , state , 'permanent' ) webbrowser . open ( url ) sys . stdout . flush ( ) client = receive_connection ( ) data = client . recv ( 1024 ) . decode ( 'utf-8' ) param_tokens = data . split ( ' ' , 2 ) [ 1 ] . split ( '?' , 1 ) [ 1 ] . split ( '&' ) params = { key : value for ( key , value ) in [ token . split ( '=' ) for token in param_tokens ] } if state != params [ 'state' ] : send_message ( client , 'State mismatch. Expected: {} Received: {}' . format ( state , params [ 'state' ] ) ) return None elif 'error' in params : send_message ( client , params [ 'error' ] ) return None refresh_token = reddit . auth . authorize ( params [ 'code' ] ) send_message ( client , 'Refresh token: {}; please close this window' . format ( refresh_token ) ) return refresh_token
short_docstring: Provide the program's entry point when directly executed.
short_docstring_tokens: Provide the program ' s entry point when directly executed .
comment: """Provide the program's entry point when directly executed."""$SEP$# scopes = ['creddits', 'edit', 'flair', 'history', 'identity',$SEP$#           'modconfig', 'modcontributors', 'modflair', 'modlog',$SEP$#           'modothers', 'modposts', 'modself', 'modwiki',$SEP$#           'mysubreddits', 'privatemessages', 'read', 'report',$SEP$#           'save', 'submit', 'subscribe', 'vote', 'wikiedit',$SEP$#           'wikiread']