<commit_before>
'''
API wrapper for holytransaction blockexplorer.
See https://peercoin.holytransaction.com/info for more information.
'''

import requests


class Holy:

    """API wrapper for holytransaction.com blockexplorer,
    it only implements queries relevant to peerassets.
    Please note that holytransactions will only provide last 100k indexed
    transactions for each address.
    """

    @classmethod
    def __init__(self, network: str):
        """
        : network = peercoin, peercoin-testnet ...
        """

        self.net = self.network_long_to_short(network)
        self.netname = self.network_short_to_long(self.net)
        self.api = "https://{network}.holytransaction.com/api/".format(network=self.netname)
        self.ext_api = "https://{network}.holytransaction.com/ext/".format(network=self.netname)
        self.api_methods = ("getdifficulty", "getrawtransaction",
                           "getblockcount", "getblockhash", "getblock")
        self.ext_api_methods = ("getaddress", "getbalance")
        self.api_session = requests.Session()

    @property
    def is_testnet(self):
        """testnet or not?"""

        if self.net == "peercoin":
            return False
        if self.net == "peercoin-testnet":
            return True

    @staticmethod
    def network_long_to_short(name):
        """convert long network name like "peercoin" to "ppc"."""

        if len(name) < 3:
            if name == "peercoin":
                return "ppc"
            if name == "peercoin-testnet":
                return "tppc"

        return name

    @staticmethod
    def network_short_to_long(name):
        """convert short network name like "ppc" to "peercoin". """

        if len(name) > 3:
            if name == "ppc":
                return "peercoin"
            if name == "tppc":
                return "peercoin-testnet"

        return name

    @property
    def network(self):
        """which network is this running on?"""
        return self.net

    @classmethod
    def req(self, query: str, params: dict):
        """Send request, return response."""<commit_msg>Holy: adopt new Provider base class.<commit_after>
'''
API wrapper for holytransaction blockexplorer.
See https://peercoin.holytransaction.com/info for more information.
'''

import requests
from .common import Provider


class Holy(Provider):

    """API wrapper for holytransaction.com blockexplorer,
    it only implements queries relevant to peerassets.
    Please note that holytransactions will only provide last 100k indexed
    transactions for each address.
    """

    @classmethod
    def __init__(self, network: str):
        """
        : network = ppc, peercoin-testnet ...
        """

        self.net = self._netname(network)['long']
        self.api = "https://{network}.holytransaction.com/api/".format(
                   network=self._netname(network)['long'])
        self.ext_api = "https://{network}.holytransaction.com/ext/".format(
                       network=self._netname(network)['long'])
        self.api_methods = ("getdifficulty", "getrawtransaction",
                           "getblockcount", "getblockhash", "getblock")
        self.ext_api_methods = ("getaddress", "getbalance")
        self.api_session = requests.Session()

    @classmethod
    def req(self, query: str, params: dict):
        """Send request, return response."""

{'fraction_non_alphanumeric': 0.11852941176470588, 'fraction_numerical': 0.002352941176470588, 'mean_word_length': 2.4353535353535354, 'pattern_counts': {'":': 6, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 6, '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': '3819353', 'n_tokens_mistral': 977, 'n_tokens_neox': 934, 'n_words': 245}