<s> import yaml <EOL> from yaml . reader import ReaderError <EOL> from yaml . scanner import ScannerError <EOL> from passpie . importers import BaseImporter <EOL> class DefaultImporter ( BaseImporter ) : <EOL> def match ( self , filepath ) : <EOL> try : <EOL> with open ( filepath ) as fp : <EOL> file_content = fp . read ( ) <EOL> except OSError : <EOL> return False <EOL> try : <EOL> dict_content = yaml . load ( file_content ) <EOL> except ( ReaderError , ScannerError ) : <EOL> return False <EOL> try : <EOL> assert dict_content . get ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> assert isinstance ( dict_content . get ( '<STR_LIT:version>' ) , float ) <EOL> except AssertionError : <EOL> return False <EOL> return True <EOL> def handle ( self , filepath ) : <EOL> with open ( filepath ) as fp : <EOL> file_content = fp . read ( ) <EOL> dict_content = yaml . load ( file_content ) <EOL> credentials = dict_content . get ( '<STR_LIT>' ) <EOL> return credentials </s>
