<commit_before>from abc import ABCMeta, abstractmethod

import traceback
import threading
import time
import hashlib
import base64
import os

base_settings = {}


class MerchantBaseLogic:
    __metaclass__ = ABCMeta

    def __init__(self):
        self.settings = {}
        self.interval = 5
        self.thread = None
        self.state = 'initialized'

    @staticmethod
    def calculate_id(token):
        return base64.b64encode(hashlib.sha256(token.encode('utf-8')).digest()).decode('utf-8')

    @staticmethod
    def get_marketplace_url():
        marketplace_url = os.getenv('PRICEWARS_MARKETPLACE_URL', 'http://vm-mpws2016hp1-04.eaalab.hpi.uni-potsdam.de:8080/marketplace')
        if not marketplace_url.startswith('http://'):
            marketplace_url = 'http://' + marketplace_url
        return marketplace_url

    @staticmethod
    def get_producer_url():
        producer_url = os.getenv('PRICEWARS_PRODUCER_URL', 'http://vm-mpws2016hp1-03.eaalab.hpi.uni-potsdam.de')
        if not producer_url.startswith('http://'):
            producer_url = 'http://' + producer_url
        return producer_url

    '''
        Threading Logic
    '''

    def run_logic_loop(self):
        self.thread = threading.Thread(target=self.run, args=())
        self.thread.daemon = True  # Demonize thread<commit_msg>add kafka url getter to SDK<commit_after>from abc import ABCMeta, abstractmethod

import traceback
import threading
import time
import hashlib
import base64
import os

base_settings = {}


class MerchantBaseLogic:
    __metaclass__ = ABCMeta

    def __init__(self):
        self.settings = {}
        self.interval = 5
        self.thread = None
        self.state = 'initialized'

    @staticmethod
    def calculate_id(token):
        return base64.b64encode(hashlib.sha256(token.encode('utf-8')).digest()).decode('utf-8')

    @staticmethod
    def get_marketplace_url():
        marketplace_url = os.getenv('PRICEWARS_MARKETPLACE_URL', 'http://vm-mpws2016hp1-04.eaalab.hpi.uni-potsdam.de:8080/marketplace')
        if not marketplace_url.startswith('http://'):
            marketplace_url = 'http://' + marketplace_url
        return marketplace_url

    @staticmethod
    def get_producer_url():
        producer_url = os.getenv('PRICEWARS_PRODUCER_URL', 'http://vm-mpws2016hp1-03.eaalab.hpi.uni-potsdam.de')
        if not producer_url.startswith('http://'):
            producer_url = 'http://' + producer_url
        return producer_url

    @staticmethod
    def get_kafka_reverse_proxy_url():
        url = os.getenv('PRICEWARS_KAFKA_REVERSE_PROXY_URL', 'http://vm-mpws2016hp1-05.eaalab.hpi.uni-potsdam.de:8001')
        if not url.startswith('http://'):
            url = 'http://' + url
        return url

    '''
        Threading Logic
    '''

    def run_logic_loop(self):
        self.thread = threading.Thread(target=self.run, args=())
        self.thread.daemon = True  # Demonize thread
{'fraction_non_alphanumeric': 0.11812905428473881, 'fraction_numerical': 0.02424035506998976, 'mean_word_length': 2.9328859060402683, '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': '3931678', 'n_tokens_mistral': 1013, 'n_tokens_neox': 954, 'n_words': 168}