<s> """<STR_LIT>""" <EOL> from future import standard_library <EOL> standard_library . install_aliases ( ) <EOL> from builtins import object <EOL> import os <EOL> from os . path import exists , join , dirname , isdir , abspath <EOL> from urllib . parse import urlencode <EOL> import inspect <EOL> class Plugin ( object ) : <EOL> """<STR_LIT>""" <EOL> verbose_name = None <EOL> """<STR_LIT>""" <EOL> short_name = None <EOL> """<STR_LIT>""" <EOL> needs_plugins = [ ] <EOL> """<STR_LIT>""" <EOL> needed_by = None <EOL> """<STR_LIT>""" <EOL> extends_models = None <EOL> """<STR_LIT>""" <EOL> ui_label = None <EOL> ui_handle_attr_name = None <EOL> """<STR_LIT>""" <EOL> media_base_url = None <EOL> """<STR_LIT>""" <EOL> media_root = None <EOL> """<STR_LIT>""" <EOL> media_name = None <EOL> """<STR_LIT>""" <EOL> url_prefix = None <EOL> """<STR_LIT>""" <EOL> site_js_snippets = [ ] <EOL> """<STR_LIT>""" <EOL> renderer = None <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , site , app_label , app_name , app_module , needed_by ) : <EOL> """<STR_LIT>""" <EOL> if site . _startup_done : <EOL> raise Exception ( <NUM_LIT> ) <EOL> self . site = site <EOL> self . app_name = app_name <EOL> self . app_label = app_label <EOL> self . app_module = app_module <EOL> self . needed_by = needed_by <EOL> if self . verbose_name is None : <EOL> self . verbose_name = app_label . title ( ) <EOL> if self . short_name is None : <EOL> self . short_name = self . verbose_name <EOL> self . on_init ( ) <EOL> def configure ( self , ** kw ) : <EOL> """<STR_LIT>""" <EOL> for k , v in list ( kw . items ( ) ) : <EOL> if not hasattr ( self , k ) : <EOL> raise Exception ( "<STR_LIT>" % ( self , k ) ) <EOL> setattr ( self , k , v ) <EOL> def get_used_libs ( self , html = None ) : <EOL> return [ ] <EOL> def on_init ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def on_site_startup ( self , site ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> @ classmethod <EOL> def extends_from ( cls ) : <EOL> """<STR_LIT>""" <EOL> for p in cls . __bases__ : <EOL> if issubclass ( p , Plugin ) : <EOL> return p <EOL> @ classmethod <EOL> def get_subdir ( cls , name ) : <EOL> """<STR_LIT>""" <EOL> p = dirname ( inspect . getfile ( cls ) ) <EOL> p = abspath ( join ( p , name ) ) <EOL> if isdir ( p ) : <EOL> return p <EOL> def before_analyze ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def on_ui_init ( self , kernel ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def __repr__ ( self ) : <EOL> l = [ ] <EOL> for k in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ) : <EOL> v = getattr ( self , k , None ) <EOL> if v is not None : <EOL> l . append ( '<STR_LIT>' % ( k , v ) ) <EOL> if len ( l ) == <NUM_LIT:0> : <EOL> return self . app_name <EOL> return "<STR_LIT>" % ( self . app_name , '<STR_LIT:U+002CU+0020>' . join ( l ) ) <EOL> def get_patterns ( self ) : <EOL> """<STR_LIT>""" <EOL> return [ ] <EOL> def get_css_includes ( self , site ) : <EOL> return [ ] <EOL> def get_js_includes ( self , settings , language ) : <EOL> return [ ] <EOL> def get_head_lines ( cls , site , request ) : <EOL> """<STR_LIT>""" <EOL> return [ ] <EOL> def get_body_lines ( cls , site , request ) : <EOL> return [ ] <EOL> def get_row_edit_lines ( self , e , panel ) : <EOL> return [ ] <EOL> def build_static_url ( self , * parts , ** kw ) : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> def build_lib_url ( self , * parts , ** kw ) : <EOL> if self . media_base_url : <EOL> url = self . media_base_url + '<STR_LIT:/>' . join ( parts ) <EOL> if len ( kw ) : <EOL> url += "<STR_LIT:?>" + urlencode ( kw ) <EOL> return url <EOL> return self . site . build_static_url ( self . media_name , * parts , ** kw ) <EOL> def build_plain_url ( self , * args , ** kw ) : <EOL> if self . url_prefix : <EOL> return self . site . buildurl ( self . url_prefix , * args , ** kw ) <EOL> return self . site . buildurl ( * args , ** kw ) <EOL> def get_menu_group ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . needed_by or self </s>
