<s> from __future__ import absolute_import , unicode_literals <EOL> VERSION = ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:0> , '<STR_LIT>' ) <EOL> __version__ = '<STR_LIT:.>' . join ( map ( str , VERSION ) ) <EOL> import logging <EOL> logger = logging . getLogger ( '<STR_LIT>' ) <EOL> class LazySettings ( object ) : <EOL> def _load_settings ( self ) : <EOL> from plata import default_settings <EOL> from django . conf import settings as django_settings <EOL> for key in dir ( default_settings ) : <EOL> if not key . startswith ( ( '<STR_LIT>' , '<STR_LIT>' ) ) : <EOL> continue <EOL> setattr ( <EOL> self , <EOL> key , <EOL> getattr ( <EOL> django_settings , <EOL> key , <EOL> getattr ( <EOL> default_settings , <EOL> key ) ) ) <EOL> def __getattr__ ( self , attr ) : <EOL> self . _load_settings ( ) <EOL> del self . __class__ . __getattr__ <EOL> return self . __dict__ [ attr ] <EOL> settings = LazySettings ( ) <EOL> shop_instance_cache = None <EOL> def register ( instance ) : <EOL> logger . debug ( '<STR_LIT>' % instance ) <EOL> global shop_instance_cache <EOL> shop_instance_cache = instance <EOL> def shop_instance ( ) : <EOL> """<STR_LIT>""" <EOL> if not shop_instance_cache : <EOL> from django . core . urlresolvers import get_resolver <EOL> get_resolver ( None ) . _populate ( ) <EOL> return shop_instance_cache <EOL> def product_model ( ) : <EOL> """<STR_LIT>""" <EOL> from django . apps import apps <EOL> return apps . get_model ( * settings . PLATA_SHOP_PRODUCT . split ( '<STR_LIT:.>' ) ) <EOL> def stock_model ( ) : <EOL> """<STR_LIT>""" <EOL> if not settings . PLATA_STOCK_TRACKING : <EOL> return None <EOL> from django . apps import apps <EOL> return apps . get_model ( * settings . PLATA_STOCK_TRACKING_MODEL . split ( '<STR_LIT:.>' ) ) </s>
