# Path: utils.py
# ONE_DAY = timedelta(1)
# 
# def yesterday():
#     return date.today() - ONE_DAY


from datetime import date
from utils import ONE_DAY, yesterday
from concurrent_base import ConcurrentBase

    _NOTIFICATION_MSG_TEMPLATE = 'SearchCommands: finished generating %s'
    FINISHED_FIND_INMATES = _NOTIFICATION_MSG_TEMPLATE % 'find inmates commands'
    FINISHED_CHECK_OF_RECENTLY_DISCHARGED_INMATES = \
        _NOTIFICATION_MSG_TEMPLATE % 'check of recently discharged inmates commands'
    FINISHED_UPDATE_INMATES_STATUS = _NOTIFICATION_MSG_TEMPLATE % 'update inmates status'

    def __init__(self, inmate_scraper, monitor):
        super(SearchCommands, self).__init__(monitor)
        self._inmate_scraper = inmate_scraper

    def check_if_really_discharged(self, discharged_inmates_ids):
        self._put(self._check_if_really_discharged, discharged_inmates_ids)

    def _check_if_really_discharged(self, discharged_inmates_ids):
        for discharged_inmate_id in discharged_inmates_ids:
            self._inmate_scraper.resurrect_if_found(discharged_inmate_id)
        self._notify(self.FINISHED_CHECK_OF_RECENTLY_DISCHARGED_INMATES)

    def find_inmates(self, exclude_list=None, number_to_fetch=MAX_INMATE_NUMBER, start_date=None):
        if exclude_list is None:
            exclude_list = []
        if start_date is None:
            start_date = yesterday()
        self._put(self._find_inmates, {'excluded_inmates': exclude_list, 'number_to_fetch': number_to_fetch,
                                       'start_date': start_date})

    def _find_inmates(self, args):
        excluded_inmates = set(args['excluded_inmates'])
        cur_date = args['start_date']

# Path: utils.py
# ONE_DAY = timedelta(1)
# 
# def yesterday():
#     return date.today() - ONE_DAY


# Path: scraper/search_commands.py
from datetime import date
from utils import ONE_DAY, yesterday
from concurrent_base import ConcurrentBase


    _NOTIFICATION_MSG_TEMPLATE = 'SearchCommands: finished generating %s'
    FINISHED_FIND_INMATES = _NOTIFICATION_MSG_TEMPLATE % 'find inmates commands'
    FINISHED_CHECK_OF_RECENTLY_DISCHARGED_INMATES = \
        _NOTIFICATION_MSG_TEMPLATE % 'check of recently discharged inmates commands'
    FINISHED_UPDATE_INMATES_STATUS = _NOTIFICATION_MSG_TEMPLATE % 'update inmates status'

    def __init__(self, inmate_scraper, monitor):
        super(SearchCommands, self).__init__(monitor)
        self._inmate_scraper = inmate_scraper

    def check_if_really_discharged(self, discharged_inmates_ids):
        self._put(self._check_if_really_discharged, discharged_inmates_ids)

    def _check_if_really_discharged(self, discharged_inmates_ids):
        for discharged_inmate_id in discharged_inmates_ids:
            self._inmate_scraper.resurrect_if_found(discharged_inmate_id)
        self._notify(self.FINISHED_CHECK_OF_RECENTLY_DISCHARGED_INMATES)

    def find_inmates(self, exclude_list=None, number_to_fetch=MAX_INMATE_NUMBER, start_date=None):
        if exclude_list is None:
            exclude_list = []
        if start_date is None:
            start_date = yesterday()
        self._put(self._find_inmates, {'excluded_inmates': exclude_list, 'number_to_fetch': number_to_fetch,
                                       'start_date': start_date})

    def _find_inmates(self, args):
        excluded_inmates = set(args['excluded_inmates'])
        cur_date = args['start_date']

        while cur_date <= yesterday():