this presenter magic makes yaml.safe_dump
    work with the objects returned from
    boto.describe_alarms()
326380
def _safe_dump(data):
    '''
    
    '''
    custom_dumper = __utils__['yaml.get_dumper']('SafeOrderedDumper')

    def boto_listelement_presenter(dumper, data):
        return dumper.represent_list(list(data))

    yaml.add_representer(boto.ec2.cloudwatch.listelement.ListElement,
                         boto_listelement_presenter,
                         Dumper=custom_dumper)

    def dimension_presenter(dumper, data):
        return dumper.represent_dict(dict(data))

    yaml.add_representer(boto.ec2.cloudwatch.dimension.Dimension,
                         dimension_presenter, Dumper=custom_dumper)

    return __utils__['yaml.dump'](data, Dumper=custom_dumper)
200573
def to_yaml(template, clean_up=False, long_form=False):
    

    data = load_json(template)

    if clean_up:
        data = clean(data)

    return dump_yaml(data, clean_up, long_form)
1359010
def dump_yaml(data, clean_up=False, long_form=False):
    

    return yaml.dump(
        data,
        Dumper=get_dumper(clean_up, long_form),
        default_flow_style=False,
        allow_unicode=True
    )
1254959
def dump(data, stream=None, **kwargs):
    '''
    
    '''
    if 'allow_unicode' not in kwargs:
        kwargs['allow_unicode'] = True
    return yaml.dump(data, stream, **kwargs)
372077
def cli(yamlfile, directory, out, classname, format):
    
    DotGenerator(yamlfile, format).serialize(classname=classname, dirname=directory, filename=out)
1345444
def yamlmod(obj, *paths):
    '''
    
    '''
    oldobj = yamlload(*paths)
    if obj is not None:
        if oldobj:
            yamlsave({**oldobj, **obj}, *paths)
        else:
            yamlsave(obj, *paths)
975048
def build_from_yamlstr(cls, yamlstr):
        
        top_dict = yaml.safe_load(yamlstr)
        coordsys = top_dict.pop('coordsys')
        output_list = []
        for e_key, e_dict in sorted(top_dict.items()):
            if e_key == 'coordsys':
                continue
            e_dict = top_dict[e_key]
            e_dict['coordsys'] = coordsys
            output_list += cls.build_from_energy_dict(e_key, e_dict)
        return output_list
1225583
function handler (eventDetails){
  var Alert = models.getModels().Alert;
  logger.logger.trace(loggerPrefix +'Processing Alerts for Event: ', eventDetails);

  Alert.queryAlerts(eventDetails.uid, eventDetails.env, eventDetails.domain, function(err, alerts){
    if(err) {
      logger.logger.warn({ error:err }, loggerPrefix +'Failed to query Alerts for uid and env', uid, env);
    } else {
      if(alerts && alerts.length > 0){
        logger.logger.trace(loggerPrefix +'Found ['+ alerts.length +'] Alerts. Matching and send emails', alerts);
        matchAndIssueAlertEmails(eventDetails, alerts);
      } else {
        logger.logger.trace(loggerPrefix +'No Alerts for event. No emails to send.');
      }
    }
  });
}
1272630
def catch_boto_400(self, message, heading=None, document=None, **info):
        """"""
        try:
            yield
        except ClientError as error:
            if str(error.response["ResponseMetadata"]["HTTPStatusCode"]).startswith("4"):
                if heading or document:
                    print("=" * 80)
                    if heading:
                        print(heading)
                    print(document)
                    print("=" * 80)
                error_message = error.response["Error"]["Message"]
                raise BadAmazon(message, error_message=error_message, error_code=error.response["ResponseMetadata"]["HTTPStatusCode"], **info)
            else:
                raise
1294130
def _handle_dumps(self, handler, **kwargs):
    

    return handler.dumps(self.__class__, to_dict(self), **kwargs)
1061723
def write_yaml_report(func):
    

    @wraps(func)
    def _wrapper(*args, **kwargs):
        now = datetime.datetime.now()
        with Timer() as timer:
            data = func(*args, **kwargs)
            if isinstance(data, (SEQUENCES, types.GeneratorType)):
                report = dict(children=list(map(str, data)))
            elif isinstance(data, MAPPINGS):
                report = data
            else:
                raise Exception('Unexpected data type: %s', type(data))
        report['elapsed'] = timer.elapsed
        report['date'] = now.isoformat()
        if "no_exec" not in kwargs and report is not None:
            with open(YAML_REPORT_FILE, 'w') as ostr:
                yaml.dump(report, ostr, default_flow_style=False)
        return report

    return _wrapper
25928
def _safe_call(obj, methname, *args, **kwargs):
    

    meth = getattr(obj, methname, None)
    if meth is None or not callable(meth):
        return

    return meth(*args, **kwargs)
114581
def save_yamlf(data: Union[list, dict], fpath: str, encoding: str) -> str:
    
    with codecs.open(fpath, mode='w', encoding=encoding) as f:
        f.write(dump_yaml(data))
        return fpath
929896
def as_yml(self):
        
        return YmlFileEvent(name=str(self.name),
                            subfolder=str(self.subfolder))
94539
def to_yaml
      YAML.dump(to_h)
    rescue => err
      raise ParseError.new(err), err
    end
937053
def model_yaml(self, **kwargs):
        
        kwargs_copy = self.base_dict.copy()
        kwargs_copy.update(**kwargs)
        self._replace_none(kwargs_copy)        
        localpath = NameFactory.model_yaml_format.format(**kwargs_copy)
        if kwargs.get('fullpath', False):
            return self.fullpath(localpath=localpath)
        return localpath
368950
def check_yamls(cls, dap):
        ''''''
        problems = list()

        for yaml in dap.assistants_and_snippets:
            path = yaml + '.yaml'
            parsed_yaml = YamlLoader.load_yaml_by_path(dap._get_file(path, prepend=True))
            if parsed_yaml:
                try:
                    yaml_checker.check(path, parsed_yaml)
                except YamlError as e:
                    problems.append(DapProblem(exc_as_decoded_string(e), level=logging.ERROR))
            else:
                problems.append(DapProblem('Empty YAML ' + path, level=logging.WARNING))

        return problems