<s> from lampost . context . resource import m_requires <EOL> m_requires ( __name__ , '<STR_LIT>' ) <EOL> def recursive_targets ( target_list , target_key ) : <EOL> for target in target_list : <EOL> if target_key in getattr ( target , '<STR_LIT>' , ( ) ) : <EOL> yield target <EOL> for sub_target in recursive_targets ( getattr ( target , '<STR_LIT>' , ( ) ) , target_key ) : <EOL> yield sub_target <EOL> def self ( target_key , entity , * _ ) : <EOL> if target_key == ( '<STR_LIT>' , ) or target_key in entity . target_keys : <EOL> yield entity <EOL> def func_owner ( target_key , entity , action , * _ ) : <EOL> return recursive_targets ( [ action . __self__ ] , target_key ) <EOL> def func_providers ( target_key , entity , action , * _ ) : <EOL> for target in action . __self__ . target_providers : <EOL> if target_key in getattr ( target , '<STR_LIT>' , ( ) ) : <EOL> yield target <EOL> def action ( target_key , entity , action ) : <EOL> return recursive_targets ( [ action ] , target_key ) <EOL> def equip ( target_key , entity , * _ ) : <EOL> return recursive_targets ( [ equip for equip in entity . inven if getattr ( equip , '<STR_LIT>' , None ) ] , target_key ) <EOL> equip . absent_msg = "<STR_LIT>" <EOL> def inven ( target_key , entity , * _ ) : <EOL> return recursive_targets ( [ equip for equip in entity . inven if not getattr ( equip , '<STR_LIT>' , None ) ] , target_key ) <EOL> inven . absent_msg = "<STR_LIT>" <EOL> def env ( target_key , entity , * _ ) : <EOL> if not target_key : <EOL> yield entity . env <EOL> for extra in entity . env . extras : <EOL> if target_key in getattr ( extra , '<STR_LIT>' , ( ) ) : <EOL> yield extra <EOL> for target in recursive_targets ( getattr ( extra , '<STR_LIT>' , ( ) ) , target_key ) : <EOL> yield target <EOL> def feature ( target_key , entity , * _ ) : <EOL> return recursive_targets ( [ feature for feature in entity . env . features ] , target_key ) <EOL> def env_living ( target_key , entity , * _ ) : <EOL> return recursive_targets ( [ living for living in entity . env . denizens ] , target_key ) <EOL> def env_items ( target_key , entity , * _ ) : <EOL> return recursive_targets ( [ item for item in entity . env . inven ] , target_key ) <EOL> defaults = [ self , equip , inven , env , feature , env_living , env_items ] <EOL> def logged_in ( target_key , * _ ) : <EOL> session = session_manager . player_session ( "<STR_LIT:U+0020>" . join ( target_key ) ) <EOL> if session : <EOL> yield session . player <EOL> logged_in . absent_msg = "<STR_LIT>" <EOL> def make ( target_class ) : <EOL> try : <EOL> return [ globals ( ) [ t_class ] for t_class in target_class . split ( '<STR_LIT:U+0020>' ) ] <EOL> except ( AttributeError , KeyError ) : <EOL> if hasattr ( target_class , '<STR_LIT>' ) : <EOL> return target_class <EOL> return [ target_class ] </s>
