<s> """<STR_LIT>""" <EOL> from . . import util <EOL> from . . orm import attributes , interfaces <EOL> HYBRID_METHOD = util . symbol ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> HYBRID_PROPERTY = util . symbol ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> class hybrid_method ( interfaces . _InspectionAttr ) : <EOL> """<STR_LIT>""" <EOL> is_attribute = True <EOL> extension_type = HYBRID_METHOD <EOL> def __init__ ( self , func , expr = None ) : <EOL> """<STR_LIT>""" <EOL> self . func = func <EOL> self . expr = expr or func <EOL> def __get__ ( self , instance , owner ) : <EOL> if instance is None : <EOL> return self . expr . __get__ ( owner , owner . __class__ ) <EOL> else : <EOL> return self . func . __get__ ( instance , owner ) <EOL> def expression ( self , expr ) : <EOL> """<STR_LIT>""" <EOL> self . expr = expr <EOL> return self <EOL> class hybrid_property ( interfaces . _InspectionAttr ) : <EOL> """<STR_LIT>""" <EOL> is_attribute = True <EOL> extension_type = HYBRID_PROPERTY <EOL> def __init__ ( self , fget , fset = None , fdel = None , expr = None ) : <EOL> """<STR_LIT>""" <EOL> self . fget = fget <EOL> self . fset = fset <EOL> self . fdel = fdel <EOL> self . expr = expr or fget <EOL> util . update_wrapper ( self , fget ) <EOL> def __get__ ( self , instance , owner ) : <EOL> if instance is None : <EOL> return self . expr ( owner ) <EOL> else : <EOL> return self . fget ( instance ) <EOL> def __set__ ( self , instance , value ) : <EOL> if self . fset is None : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> self . fset ( instance , value ) <EOL> def __delete__ ( self , instance ) : <EOL> if self . fdel is None : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> self . fdel ( instance ) <EOL> def setter ( self , fset ) : <EOL> """<STR_LIT>""" <EOL> self . fset = fset <EOL> return self <EOL> def deleter ( self , fdel ) : <EOL> """<STR_LIT>""" <EOL> self . fdel = fdel <EOL> return self <EOL> def expression ( self , expr ) : <EOL> """<STR_LIT>""" <EOL> self . expr = expr <EOL> return self <EOL> def comparator ( self , comparator ) : <EOL> """<STR_LIT>""" <EOL> proxy_attr = attributes . create_proxied_attribute ( self ) <EOL> def expr ( owner ) : <EOL> return proxy_attr ( owner , self . __name__ , self , comparator ( owner ) ) <EOL> self . expr = expr <EOL> return self <EOL> class Comparator ( interfaces . PropComparator ) : <EOL> """<STR_LIT>""" <EOL> property = None <EOL> def __init__ ( self , expression ) : <EOL> self . expression = expression <EOL> def __clause_element__ ( self ) : <EOL> expr = self . expression <EOL> while hasattr ( expr , '<STR_LIT>' ) : <EOL> expr = expr . __clause_element__ ( ) <EOL> return expr <EOL> def adapt_to_entity ( self , adapt_to_entity ) : <EOL> return self </s>
