original_docstring:  Saves the current feed index and altered tweet stats. 
docstring: Saves the current feed index and altered tweet stats.
docstring_tokens: Saves the current feed index and altered tweet stats .
code: def _save_tweet_data(self, index=0, tweet=None):
          """ Saves the current feed index and altered tweet stats. """
          all_tweet_data = dict()
          #Prepare all_tweet_data; attempt to load existing data
          if os.path.exists(self.config.filenames['stats']): #Load existing data
              with open(self.config.filenames['stats'], 'r', encoding="utf8") as infile:
                  all_tweet_data = json.load(infile)
              copyfile(self.config.filenames['stats'], self.config.filenames['stats'] + ".bak")
          else:
              all_tweet_data = {"feed_index": 0}
          #Edit all_tweet_data
          if BotFunctions.SaveTweetIndex in self.functionality and index > 0:
              all_tweet_data['feed_index'] = index
          if BotFunctions.SaveTweetStats in self.functionality and tweet:
              if tweet.author.id == self.config.my_id: #Bot tweeted this
                  all_tweet_data['tweet_stats'][tweet.id]['title'] = tweet.title
          #Save all_tweet_data to config.filenames['stats']
          with open(self.config.filenames['stats'], 'w', encoding="utf8") as outfile:
              json.dump(all_tweet_data, outfile)
code_tokens: def _save_tweet_data ( self , index = 0 , tweet = None ) : all_tweet_data = dict ( ) if os . path . exists ( self . config . filenames [ 'stats' ] ) : with open ( self . config . filenames [ 'stats' ] , 'r' , encoding = "utf8" ) as infile : all_tweet_data = json . load ( infile ) copyfile ( self . config . filenames [ 'stats' ] , self . config . filenames [ 'stats' ] + ".bak" ) else : all_tweet_data = { "feed_index" : 0 } if BotFunctions . SaveTweetIndex in self . functionality and index > 0 : all_tweet_data [ 'feed_index' ] = index if BotFunctions . SaveTweetStats in self . functionality and tweet : if tweet . author . id == self . config . my_id : all_tweet_data [ 'tweet_stats' ] [ tweet . id ] [ 'title' ] = tweet . title with open ( self . config . filenames [ 'stats' ] , 'w' , encoding = "utf8" ) as outfile : json . dump ( all_tweet_data , outfile )
short_docstring: Saves the current feed index and altered tweet stats.
short_docstring_tokens: Saves the current feed index and altered tweet stats .
comment: """ Saves the current feed index and altered tweet stats. """$SEP$#Prepare all_tweet_data; attempt to load existing data$SEP$#Load existing data$SEP$#Edit all_tweet_data$SEP$#Bot tweeted this$SEP$#Save all_tweet_data to config.filenames['stats']