





import csv

import tweepy

# Twitter API credentials
__UpperCAmelCase	:       str    	=							""
__UpperCAmelCase	:       Optional[Any]    	=							""
__UpperCAmelCase	:       Optional[Any]    	=							""
__UpperCAmelCase	:       Any    	=							""







def       A__							(   SCREAMING_SNAKE_CASE__)       ->   None:
  # authorize twitter, initialize tweepy
  __snake_case:						Any			  =						tweepy.OAuthHandler(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__)
  auth.set_access_token(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__)
  __snake_case:						Dict			  =						tweepy.API(SCREAMING_SNAKE_CASE__)

  # initialize a list to hold all the tweepy Tweets
  __snake_case:						Dict			  =						[]

  # make initial request for most recent tweets (200 is the maximum allowed count)
  __snake_case:						int			  =						api.user_timeline(screen_name=SCREAMING_SNAKE_CASE__ , count=200)

  # save most recent tweets
  alltweets.extend(SCREAMING_SNAKE_CASE__)

  # save the id of the oldest tweet less one
  __snake_case:						Optional[Any]			  =						alltweets[-1].id - 1

  # keep grabbing tweets until there are no tweets left to grab
  while len(SCREAMING_SNAKE_CASE__) > 0:
    print(F'''getting tweets before {oldest}''')

    # all subsequent requests use the max_id param to prevent duplicates
    __snake_case:						str			  =						api.user_timeline(
        screen_name=SCREAMING_SNAKE_CASE__ , count=200 , max_id=SCREAMING_SNAKE_CASE__)

    # save most recent tweets
    alltweets.extend(SCREAMING_SNAKE_CASE__)

    # update the id of the oldest tweet less one
    __snake_case:						str			  =						alltweets[-1].id - 1

    print(F'''...{len(SCREAMING_SNAKE_CASE__)} tweets downloaded so far''')

  # transform the tweepy tweets into a 2D array that will populate the csv
  __snake_case:						Optional[Any]			  =						[[tweet.id_str, tweet.created_at, tweet.text] for tweet in alltweets]

  # write the csv
  with open(F'''new_{screen_name}_tweets.csv''' , """w""") as f:
    __snake_case:						str			  =						csv.writer(SCREAMING_SNAKE_CASE__)
    writer.writerow(["""id""", """created_at""", """text"""])
    writer.writerows(SCREAMING_SNAKE_CASE__)


if __name__ == "__main__":
      # pass in the username of the account you want to download
      get_all_tweets("FirePing32")













import math







def       A__							(   SCREAMING_SNAKE_CASE__)       ->   int:

  if not isinstance(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__):
    __snake_case:						Optional[int]			  =						F'''Input value of [number={number}] must be an integer'''
    raise TypeError(SCREAMING_SNAKE_CASE__)

  if number < 1:
    __snake_case:						Optional[int]			  =						F'''Input value of [number={number}] must be > 0'''
    raise ValueError(SCREAMING_SNAKE_CASE__)
  elif number == 1:
    return 3
  elif number == 2:
    return 5
  else:
    __snake_case:						List[Any]			  =						int(math.log(number // 3 , 2)) + 2

    __snake_case:						str			  =						[3, 5]
    __snake_case:						int			  =						2
    __snake_case:						List[str]			  =						3
    for block in range(1 , SCREAMING_SNAKE_CASE__):
      for _ in range(SCREAMING_SNAKE_CASE__):
        proth_list.append(2 ** (block + 1) + proth_list[proth_index - 1])
        proth_index += 1
      increment *= 2

  return proth_list[number - 1]


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      for number in range(11):
            __UpperCAmelCase	:       Optional[int]    	=							0
            try:
                  __UpperCAmelCase	:       int    	=							proth(number)
            except ValueError:
                  print(f'ValueError: there is no {number}th Proth number')
                  continue

            print(f'The {number}th Proth number: {value}')






