<commit_before>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import aiohttp
import asyncio
import jmespath
import json
import logging
import requests
import signal

from .providers import providers

logging.basicConfig(level=logging.DEBUG)
logging.getLogger("requests").setLevel(logging.WARNING)

class ActivityCount(object):
  """Gather activity/share stats from social APIs"""
  def __init__(self, url=None):
    self.url = url or None
    self.responses = []

  def establish_client(self, loop):
    self.loop = asyncio.new_event_loop()
    self.client = aiohttp.ClientSession(loop=self.loop)
    asyncio.set_event_loop(self.loop)

  async def async_get_all(self, loop):
    self.establish_client(loop)
    
    for provider in providers:
      url = provider["endpoint"].format(self.url)
      asyncio.ensure_future(self.collect_sharecount(url, provider), loop=self.loop)

    # loop over all providers
    pending = asyncio.Task.all_tasks(loop=self.loop)
    self.loop.run_until_complete(asyncio.gather(*pending, loop=self.loop))<commit_msg>silence logging<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import aiohttp
import asyncio
import jmespath
import json
import logging
import requests
import signal

from .providers import providers

logging.basicConfig(level=logging.WARNING)
logging.getLogger("requests").setLevel(logging.WARNING)

class ActivityCount(object):
  """Gather activity/share stats from social APIs"""
  def __init__(self, url=None):
    self.url = url or None
    self.responses = []

  def establish_client(self, loop):
    self.loop = asyncio.new_event_loop()
    self.client = aiohttp.ClientSession(loop=self.loop)
    asyncio.set_event_loop(self.loop)

  async def async_get_all(self, loop):
    self.establish_client(loop)
    
    for provider in providers:
      url = provider["endpoint"].format(self.url)
      asyncio.ensure_future(self.collect_sharecount(url, provider), loop=self.loop)

    # loop over all providers
    pending = asyncio.Task.all_tasks(loop=self.loop)
    self.loop.run_until_complete(asyncio.gather(*pending, loop=self.loop))
{'fraction_non_alphanumeric': 0.11333333333333333, 'fraction_numerical': 0.0019047619047619048, 'mean_word_length': 4.528947368421052, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1750315', 'n_tokens_mistral': 661, 'n_tokens_neox': 650, 'n_words': 140}