import logging
from datetime import datetime

TARGET_TIME_IN_SECONDS = 12 
BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY = 256

class DifficultyAdjuster:
    """Class that adjusts difficulty given amount of blocks sent"""
    def __init__(self):
        self._difficulty = 1
        self.blocks_processed = 0    
        self.start_time = datetime.now()

    def add_block_to_count(self):
        self.blocks_processed += 1
        if self.blocks_processed >= BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY:
            logging.info("[DIFFICULTY_ADJUSTER] Difficulty is being adjusted...")
            elapsed_time = (datetime.now() - self.start_time).total_seconds()
            self._difficulty = self.__adjust_difficulty(self.difficulty, elapsed_time, TARGET_TIME_IN_SECONDS, self.blocks_processed)
            self.blocks_processed = 0
            self.start_time = datetime.now()

    @property
    def difficulty(self):
        return self._difficulty

    def __adjust_difficulty(self, prev_difficulty, elapsed_time, target_time, blocks_processed):
        return prev_difficulty * (blocks_processed/elapsed_time) * target_time

b01fbb539e493b7dbc3ea4093604b9c4e67d805e
<mask token>


class DifficultyAdjuster:
    <mask token>
    <mask token>

    def add_block_to_count(self):
        self.blocks_processed += 1
        if self.blocks_processed >= BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY:
            logging.info(
                '[DIFFICULTY_ADJUSTER] Difficulty is being adjusted...')
            elapsed_time = (datetime.now() - self.start_time).total_seconds()
            self._difficulty = self.__adjust_difficulty(self.difficulty,
                elapsed_time, TARGET_TIME_IN_SECONDS, self.blocks_processed)
            self.blocks_processed = 0
            self.start_time = datetime.now()

    @property
    def difficulty(self):
        return self._difficulty

    def __adjust_difficulty(self, prev_difficulty, elapsed_time,
        target_time, blocks_processed):
        return prev_difficulty * (blocks_processed / elapsed_time
            ) * target_time

<mask token>


class DifficultyAdjuster:
    """Class that adjusts difficulty given amount of blocks sent"""

    def __init__(self):
        self._difficulty = 1
        self.blocks_processed = 0
        self.start_time = datetime.now()

    def add_block_to_count(self):
        self.blocks_processed += 1
        if self.blocks_processed >= BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY:
            logging.info(
                '[DIFFICULTY_ADJUSTER] Difficulty is being adjusted...')
            elapsed_time = (datetime.now() - self.start_time).total_seconds()
            self._difficulty = self.__adjust_difficulty(self.difficulty,
                elapsed_time, TARGET_TIME_IN_SECONDS, self.blocks_processed)
            self.blocks_processed = 0
            self.start_time = datetime.now()

    @property
    def difficulty(self):
        return self._difficulty

    def __adjust_difficulty(self, prev_difficulty, elapsed_time,
        target_time, blocks_processed):
        return prev_difficulty * (blocks_processed / elapsed_time
            ) * target_time

<mask token>
TARGET_TIME_IN_SECONDS = 12
BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY = 256


class DifficultyAdjuster:
    """Class that adjusts difficulty given amount of blocks sent"""

    def __init__(self):
        self._difficulty = 1
        self.blocks_processed = 0
        self.start_time = datetime.now()

    def add_block_to_count(self):
        self.blocks_processed += 1
        if self.blocks_processed >= BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY:
            logging.info(
                '[DIFFICULTY_ADJUSTER] Difficulty is being adjusted...')
            elapsed_time = (datetime.now() - self.start_time).total_seconds()
            self._difficulty = self.__adjust_difficulty(self.difficulty,
                elapsed_time, TARGET_TIME_IN_SECONDS, self.blocks_processed)
            self.blocks_processed = 0
            self.start_time = datetime.now()

    @property
    def difficulty(self):
        return self._difficulty

    def __adjust_difficulty(self, prev_difficulty, elapsed_time,
        target_time, blocks_processed):
        return prev_difficulty * (blocks_processed / elapsed_time
            ) * target_time

import logging
from datetime import datetime
TARGET_TIME_IN_SECONDS = 12
BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY = 256


class DifficultyAdjuster:
    """Class that adjusts difficulty given amount of blocks sent"""

    def __init__(self):
        self._difficulty = 1
        self.blocks_processed = 0
        self.start_time = datetime.now()

    def add_block_to_count(self):
        self.blocks_processed += 1
        if self.blocks_processed >= BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY:
            logging.info(
                '[DIFFICULTY_ADJUSTER] Difficulty is being adjusted...')
            elapsed_time = (datetime.now() - self.start_time).total_seconds()
            self._difficulty = self.__adjust_difficulty(self.difficulty,
                elapsed_time, TARGET_TIME_IN_SECONDS, self.blocks_processed)
            self.blocks_processed = 0
            self.start_time = datetime.now()

    @property
    def difficulty(self):
        return self._difficulty

    def __adjust_difficulty(self, prev_difficulty, elapsed_time,
        target_time, blocks_processed):
        return prev_difficulty * (blocks_processed / elapsed_time
            ) * target_time

import logging
from datetime import datetime

TARGET_TIME_IN_SECONDS = 12 
BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY = 256

class DifficultyAdjuster:
    """Class that adjusts difficulty given amount of blocks sent"""
    def __init__(self):
        self._difficulty = 1
        self.blocks_processed = 0    
        self.start_time = datetime.now()

    def add_block_to_count(self):
        self.blocks_processed += 1
        if self.blocks_processed >= BLOCKS_PROCESSED_TO_ADJUST_DIFFICULTY:
            logging.info("[DIFFICULTY_ADJUSTER] Difficulty is being adjusted...")
            elapsed_time = (datetime.now() - self.start_time).total_seconds()
            self._difficulty = self.__adjust_difficulty(self.difficulty, elapsed_time, TARGET_TIME_IN_SECONDS, self.blocks_processed)
            self.blocks_processed = 0
            self.start_time = datetime.now()

    @property
    def difficulty(self):
        return self._difficulty

    def __adjust_difficulty(self, prev_difficulty, elapsed_time, target_time, blocks_processed):
        return prev_difficulty * (blocks_processed/elapsed_time) * target_time
