# Path: history/utils.py
# def irc(message):
#     open(settings.PROJECT_PATH + "/log/irc", "a").write(message.strip() + "\n")
# 
# Path: scraper/tasks.py
# def async_http(url):


import re
import logging
            import sys
from urllib import quote
from history.utils import irc
from .tasks import app
    def __init__(self, *args, **kwargs):
        dict.__init__(self, *args, **kwargs)
        self.accessed = set()

    def __getitem__(self, key):
        self.accessed.add(key)
        return dict.__getitem__(self, key)

    def get_not_accessed_keys(self):
        a = []
        for i in self.keys():
            if i not in self.accessed:
                a.append(i)
            elif isinstance(self[i], AccessControlDict) and self[i].get_not_accessed_keys():
                a.append(i)
                a.append(self[i].get_not_accessed_keys())

        return a

    def die_if_got_not_accessed_keys(self):
        if self.get_not_accessed_keys():
            logger.error("\nError: untreated sections:")
            irc("\nError: untreated sections:")
            for i in self.get_not_accessed_keys():
                if isinstance(i, (str, unicode)):
                    logger.error("* %s" % i)
                    irc("* %s" % i.encode("Utf-8"))
                else:
                    for j in i:
                        logger.error("    * %s" % j)

# Path: history/utils.py
# def irc(message):
#     open(settings.PROJECT_PATH + "/log/irc", "a").write(message.strip() + "\n")
# 
# Path: scraper/tasks.py
# def async_http(url):


# Path: scraper/utils.py
import re
import logging
            import sys
from urllib import quote
from history.utils import irc
from .tasks import app

    def __init__(self, *args, **kwargs):
        dict.__init__(self, *args, **kwargs)
        self.accessed = set()

    def __getitem__(self, key):
        self.accessed.add(key)
        return dict.__getitem__(self, key)

    def get_not_accessed_keys(self):
        a = []
        for i in self.keys():
            if i not in self.accessed:
                a.append(i)
            elif isinstance(self[i], AccessControlDict) and self[i].get_not_accessed_keys():
                a.append(i)
                a.append(self[i].get_not_accessed_keys())

        return a

    def die_if_got_not_accessed_keys(self):
        if self.get_not_accessed_keys():
            logger.error("\nError: untreated sections:")
            irc("\nError: untreated sections:")
            for i in self.get_not_accessed_keys():
                if isinstance(i, (str, unicode)):
                    logger.error("* %s" % i)
                    irc("* %s" % i.encode("Utf-8"))
                else:
                    for j in i:
                        logger.error("    * %s" % j)

                        irc("    * %s" % j.encode("Utf-8"))