<commit_before># -*- coding: utf-8 -*-
"""
Twitter API class
"""
import time
import tweepy


class TwitterApi(object):
    def __init__(self, api_key, api_secret, access_token, access_token_secret):
        # Authorise twitter access
        auth = tweepy.OAuthHandler(api_key, api_secret)
        auth.set_access_token(access_token, access_token_secret)
        # Initialise twitter api
        self.twitter_api = tweepy.API(auth)
        # In case of error, try again one more time after n seconds
        self.wait_seconds = 60

    def assemble_tweet_text(self, tweet_text, short_url, text_len=85):
        """Assemble tweet status"""
        c2del = [('\n', ' '),
                 ('  ', ' ')]
        for c in c2del:
            tweet_text = tweet_text.replace(*c)
        if len(tweet_text) > text_len:
            ellipsis = '... '
        else:
            ellipsis = ' '
        # title: <text_len> characters, shortened url: ~21,<commit_msg>update default tweet length<commit_after># -*- coding: utf-8 -*-
"""
Twitter API class
"""
import time
import tweepy


class TwitterApi(object):
    def __init__(self, api_key, api_secret, access_token, access_token_secret):
        # Authorise twitter access
        auth = tweepy.OAuthHandler(api_key, api_secret)
        auth.set_access_token(access_token, access_token_secret)
        # Initialise twitter api
        self.twitter_api = tweepy.API(auth)
        # In case of error, try again one more time after n seconds
        self.wait_seconds = 60

    def assemble_tweet_text(self, tweet_text, short_url, text_len=225):
        """Assemble tweet status"""
        c2del = [('\n', ' '),
                 ('  ', ' ')]
        for c in c2del:
            tweet_text = tweet_text.replace(*c)
        if len(tweet_text) > text_len:
            ellipsis = '... '
        else:
            ellipsis = ' '
        # title: <text_len> characters, shortened url: ~21,
{'fraction_non_alphanumeric': 0.11255862428348098, 'fraction_numerical': 0.009900990099009901, 'mean_word_length': 2.380281690140845, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5236895', 'n_tokens_mistral': 622, 'n_tokens_neox': 593, 'n_words': 148}