<s> import yaml <EOL> if hasattr ( yaml , '<STR_LIT>' ) : <EOL> yaml_loader = yaml . CSafeLoader <EOL> else : <EOL> yaml_loader = yaml . SafeLoader <EOL> if hasattr ( yaml , '<STR_LIT>' ) : <EOL> yaml_dumper = yaml . CSafeDumper <EOL> else : <EOL> yaml_dumper = yaml . SafeDumper <EOL> def load ( s ) : <EOL> try : <EOL> yml_dict = yaml . load ( s , yaml_loader ) <EOL> except yaml . YAMLError as exc : <EOL> msg = '<STR_LIT>' <EOL> if hasattr ( exc , '<STR_LIT>' ) : <EOL> msg += '<STR_LIT>' % ( exc . problem_mark . line + <NUM_LIT:1> , <EOL> exc . problem_mark . column + <NUM_LIT:1> ) <EOL> raise ValueError ( msg ) <EOL> if not isinstance ( yml_dict , dict ) and not isinstance ( yml_dict , list ) : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> if isinstance ( yml_dict , dict ) and len ( yml_dict ) < <NUM_LIT:1> : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> return yml_dict <EOL> def dump ( s ) : <EOL> return yaml . dump ( s , Dumper = yaml_dumper ) </s>
