# Path: intuition/errors.py
# class LoadMarketSchemeFailed(dna.errors.FactoryError):
#     msg = "Failed to load market scheme: {reason}"


import os
import random
import pytz
import dateutil.parser
import yaml
import dna.logging
from intuition.errors import LoadMarketSchemeFailed
    def timezone(self):
        return self.scheme.get('timezone') or self.default_timezone

    @property
    def open(self):
        safe_open = self.scheme.get('open') or self.default_open
        return pytz.timezone(self.timezone)\
            .localize(dateutil.parser.parse(safe_open))\
            .astimezone(pytz.utc)

    @property
    def close(self):
        # Check if a specific market scheme was set
        safe_close = self.scheme.get('close') or self.default_close
        return pytz.timezone(self.timezone)\
            .localize(dateutil.parser.parse(safe_close))\
            .astimezone(pytz.utc)

    def _lookup_sids(self, market, limit=-1):
        market = market.split(':')

        try:
            if 'forex' in market:
                sids = self._extract_forex()
            elif 'paris' in market:
                sids = self._extract_cac40(market)
            else:
                raise NotImplementedError(
                    'market {} not supported'.format(market))
        except Exception, error:

# Path: intuition/errors.py
# class LoadMarketSchemeFailed(dna.errors.FactoryError):
#     msg = "Failed to load market scheme: {reason}"


# Path: intuition/data/universe.py
import os
import random
import pytz
import dateutil.parser
import yaml
import dna.logging
from intuition.errors import LoadMarketSchemeFailed

    def timezone(self):
        return self.scheme.get('timezone') or self.default_timezone

    @property
    def open(self):
        safe_open = self.scheme.get('open') or self.default_open
        return pytz.timezone(self.timezone)\
            .localize(dateutil.parser.parse(safe_open))\
            .astimezone(pytz.utc)

    @property
    def close(self):
        # Check if a specific market scheme was set
        safe_close = self.scheme.get('close') or self.default_close
        return pytz.timezone(self.timezone)\
            .localize(dateutil.parser.parse(safe_close))\
            .astimezone(pytz.utc)

    def _lookup_sids(self, market, limit=-1):
        market = market.split(':')

        try:
            if 'forex' in market:
                sids = self._extract_forex()
            elif 'paris' in market:
                sids = self._extract_cac40(market)
            else:
                raise NotImplementedError(
                    'market {} not supported'.format(market))
        except Exception, error:

            raise LoadMarketSchemeFailed(reason=error)