<s> from . has_one_or_many import HasOneOrMany <EOL> from . result import Result <EOL> class HasOne ( HasOneOrMany ) : <EOL> def get_results ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _query . first ( ) <EOL> def init_relation ( self , models , relation ) : <EOL> """<STR_LIT>""" <EOL> for model in models : <EOL> model . set_relation ( relation , Result ( None , self , model ) ) <EOL> return models <EOL> def match ( self , models , results , relation ) : <EOL> """<STR_LIT>""" <EOL> return self . match_one ( models , results , relation ) <EOL> def _new_instance ( self , model ) : <EOL> return HasOne ( <EOL> self . new_query ( ) , <EOL> model , <EOL> self . _foreign_key , <EOL> self . _local_key <EOL> ) </s>
