<commit_before># coding=utf-8
import logging
import json
import os
import re
import requests

logger = logging.getLogger(__name__)


CHANGECOIN_API = os.getenv("CHANGECOIN_API", "https://api.changetip.com/v1")


class DuplicateTipException(Exception):
    pass


class BaseBot(object):

    # Override this with the name of the channel.Must have correspond
    # The API must know about it ahead of time
    # To register a new bot, contact <EMAIL>
    changetip_api_key = None  # api key for the bot to submit transactions
    username = None  # username on the site
    prefix = "@"
    last_context_uid = None
    proxy = None
    # How many seconds the bot runner should wait before checking for new tips
    new_tip_check_delay = 15

    def __str__(self):
        return "%s bot with %s proxy %s" % (self.__class__.__name__, self.username, self.proxy)

    @property
    def name(self):
        return self.__class__.__name__.lower()

    def mention_bot(self):
        return "%s%s" % (self.prefix, self.username)

    def mention(self, username):
        return '%s%s' % (self.prefix, username)

    def dupecheck(self, context_uid):
        """ Check locally for duplicates before submitting
        Should raise a DuplicateTipException if duplicate is found
        """
        return True

    def check_for_new_tips(self, last):
        """ Poll the site for new tips. Expected to return an array of tips, in the format passed to send_tip """
        raise NotImplementedError

    def send_tip(self, sender, receiver, message, context_uid, meta):
        """ Send a request to the ChangeTip API, to be delivered immediately. """
        assert self.channel is not None, "channel must be defined"<commit_msg> added some notes to better explain last context uid<commit_after># coding=utf-8
import logging
import json
import os
import re
import requests

logger = logging.getLogger(__name__)


CHANGECOIN_API = os.getenv("CHANGECOIN_API", "https://api.changetip.com/v1")


class DuplicateTipException(Exception):
    pass


class BaseBot(object):

    # Override this with the name of the channel.Must have correspond
    # The API must know about it ahead of time
    # To register a new bot, contact <EMAIL>
    changetip_api_key = None  # api key for the bot to submit transactions
    username = None  # username on the site
    prefix = "@"
    last_context_uid = None # used if you need to page through your channel's tips via some "last used" identifier
    proxy = None
    # How many seconds the bot runner should wait before checking for new tips
    new_tip_check_delay = 15

    def __str__(self):
        return "%s bot with %s proxy %s" % (self.__class__.__name__, self.username, self.proxy)

    @property
    def name(self):
        return self.__class__.__name__.lower()

    def mention_bot(self):
        return "%s%s" % (self.prefix, self.username)

    def mention(self, username):
        return '%s%s' % (self.prefix, username)

    def dupecheck(self, context_uid):
        """ Check locally for duplicates before submitting
        Should raise a DuplicateTipException if duplicate is found
        """
        return True

    def check_for_new_tips(self, last):
        """ Poll the site for new tips. Expected to return an array of tips, in the format passed to send_tip """
        # currently only the last_context_uid value is returned.  You can call it like: last.get("last_context_uid", 0)
        raise NotImplementedError

    def send_tip(self, sender, receiver, message, context_uid, meta):
        """ Send a request to the ChangeTip API, to be delivered immediately. """
        assert self.channel is not None, "channel must be defined"
{'fraction_non_alphanumeric': 0.08166033640803039, 'fraction_numerical': 0.0024416711882799783, 'mean_word_length': 3.152027027027027, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1642341', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1027, 'n_words': 405}