<commit_before>from slackclient import SlackClient
from notify.core import config_parser


class Slack(object):
    def __init__(self, org_name):
        self.org_name = org_name
        self.slack_conf = {}
        self.conf = {}
        self.slack_client = None

    def _get_client(self):
        return self.slack_client

    def _get_conf(self):
        return self.conf

    def _get_slack_conf(self):
        return self.slack_conf

    def init_client(self):
        self.conf = config_parser.ConfLoader().get_config('slack')
        if self.conf:
            self.slack_conf = config_parser.Config(self.conf).get_service('slack', self.org_name)

        if self.slack_conf:
            self.slack_client = SlackClient(self.slack_conf[0].get('token'))

    def _call(self, command):
        return self.slack_client.api_call(command)

    def _auth_test(self):
        return self._call('auth.test')

    def _api_test(self):
        return self._call('api.test')

    def channels_list(self):
        channels = self._call('channels.list')
        if channels.get('ok'):
            return channels
        else:
            return {}

    def channels_names_and_id(self):
        result = {}
        ch = self.channels_list()
        if ch:
            return {x.get('name'): x.get('id') for x in ch['channels']}
        else:
            return result

    def send_message(self, channel_id, message):
        sent = self.slack_client.api_call(
            "chat.postMessage",
            channel=channel_id,
            text=message,
            username='notify bot',
            icon_emoji=':see_no_evil:'
        )
        return sent


class HipChat(object):
    def __init__(self):
        pass


class DataDog(object):
    def __init__(self):
        pass
<commit_msg>plugin: slack: change to use github logo of org were this service will be uploded<commit_after>from slackclient import SlackClient
from notify.core import config_parser


class Slack(object):
    def __init__(self, org_name):
        self.org_name = org_name
        self.slack_conf = {}
        self.conf = {}
        self.slack_client = None

    def _get_client(self):
        return self.slack_client

    def _get_conf(self):
        return self.conf

    def _get_slack_conf(self):
        return self.slack_conf

    def init_client(self):
        self.conf = config_parser.ConfLoader().get_config('slack')
        if self.conf:
            self.slack_conf = config_parser.Config(self.conf).get_service('slack', self.org_name)

        if self.slack_conf:
            self.slack_client = SlackClient(self.slack_conf[0].get('token'))

    def _call(self, command):
        return self.slack_client.api_call(command)

    def _auth_test(self):
        return self._call('auth.test')

    def _api_test(self):
        return self._call('api.test')

    def channels_list(self):
        channels = self._call('channels.list')
        if channels.get('ok'):
            return channels
        else:
            return {}

    def channels_names_and_id(self):
        result = {}
        ch = self.channels_list()
        if ch:
            return {x.get('name'): x.get('id') for x in ch['channels']}
        else:
            return result

    def send_message(self, channel_id, message):
        sent = self.slack_client.api_call(
            "chat.postMessage",
            channel=channel_id,
            text=message,
            username='notify bot',
            icon_url='https://avatars1.githubusercontent.com/u/19374687?v=3&s=48'
        )
        return sent


class HipChat(object):
    def __init__(self):
        pass


class DataDog(object):
    def __init__(self):
        pass

{'fraction_non_alphanumeric': 0.10616345370621776, 'fraction_numerical': 0.0038012489818083084, 'mean_word_length': 2.2230971128608923, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '1750855', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1109, 'n_words': 230}