<commit_before>import json
import asyncio
from api.indy.agent import Holder
from api.indy.claimDefParser import ClaimDefParser
import logging
from api.indy import eventloop

class ClaimDefProcesser(object):
  """
  Parses and processes a claim definition.
  """

  def __init__(self, claimDef) -> None:
    self.__logger = logging.getLogger(__name__)
    self.__claimDefParser = ClaimDefParser(claimDef)

  async def __StoreClaimOffer(self):
    self.__logger.debug(">>> Storing claim offer ...")
    async with Holder() as holder:
      await holder.store_claim_offer(
        self.__claimDefParser.did,
        self.__claimDefParser.seqNo
      )
    self.__logger.debug("<<< Storing claim offer.")


  async def __StoreClaimRequest(self):
    self.__logger.debug(">>> Storing claim request ...")
    async with Holder() as holder:
      claim_request = await holder.store_claim_req(
        self.__claimDefParser.did,
        self.__claimDefParser.claimDefinition
      )
    self.__logger.debug("<<< Storing claim request.")
    return claim_request

  async def __GenerateRequest(self):
    self.__logger.debug("Generating claim request ...")
    await self.__StoreClaimOffer()
    claim_request = await self.__StoreClaimRequest()

    self.__logger.debug(
      "\n============================================================================\n" +
      "Claim request generated:\n" +
      "----------------------------------------------------------------------------\n" +
      "{0}\n".format(json.dumps(json.loads(claim_request), indent=4)) +
      "============================================================================\n")

    return claim_request

  def GenerateClaimRequest(self):
    return eventloop.do(self.__GenerateRequest())
<commit_msg>Minor logging update<commit_after>import json
import asyncio
from api.indy.agent import Holder
from api.indy.claimDefParser import ClaimDefParser
import logging
from api.indy import eventloop

class ClaimDefProcesser(object):
  """
  Parses and processes a claim definition.
  """

  def __init__(self, claimDef) -> None:
    self.__logger = logging.getLogger(__name__)
    self.__claimDefParser = ClaimDefParser(claimDef)

  async def __StoreClaimOffer(self):
    self.__logger.debug(">>> Storing claim offer ...")
    async with Holder() as holder:
      await holder.store_claim_offer(
        self.__claimDefParser.did,
        self.__claimDefParser.seqNo
      )
    self.__logger.debug("<<< Storing claim offer.")


  async def __StoreClaimRequest(self):
    self.__logger.debug(">>> Storing claim request ...")
    async with Holder() as holder:
      claim_request = await holder.store_claim_req(
        self.__claimDefParser.did,
        self.__claimDefParser.claimDefinition
      )
    self.__logger.debug("<<< Storing claim request.")
    return claim_request

  async def __GenerateRequest(self):
    self.__logger.debug("Generating claim request ...")
    await self.__StoreClaimOffer()
    claim_request = await self.__StoreClaimRequest()

    self.__logger.debug(
      "\n============================================================================\n" +
      "Claim request generated:\n" +
      "----------------------------------------------------------------------------\n" +
      "{0}\n".format(json.dumps(json.loads(claim_request), indent=2)) +
      "============================================================================\n")

    return claim_request

  def GenerateClaimRequest(self):
    return eventloop.do(self.__GenerateRequest())

{'fraction_non_alphanumeric': 0.22656471254602095, 'fraction_numerical': 0.0011328235627301047, 'mean_word_length': 3.1700118063754426, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '7199549', 'n_tokens_mistral': 938, 'n_tokens_neox': 895, 'n_words': 208}