Tries to fetch Marshal representation first, then YAML
517347
def fetch_single_spec(source_uri, spec_name)
      @fetch_error = nil

      begin
        marshal_uri = source_uri + "quick/Marshal.#{Gem.marshal_version}/#{spec_name}.gemspec.rz"
        zipped = fetcher.fetch_path marshal_uri
        return Marshal.load(unzip(zipped))
      rescue => ex
        @fetch_error = ex

        if Gem.configuration.really_verbose then
          say "unable to fetch marshal gemspec #{marshal_uri}: #{ex.class} - #{ex}"
        end
      end

      begin
        yaml_uri = source_uri + "quick/#{spec_name}.gemspec.rz"
        zipped = fetcher.fetch_path yaml_uri
        return YAML.load(unzip(zipped))
      rescue => ex
        @fetch_error = ex
        if Gem.configuration.really_verbose then
          say "unable to fetch YAML gemspec #{yaml_uri}: #{ex.class} - #{ex}"
        end
      end

      nil
    end
267418
def to_yaml
      require 'yaml'
      trackers_export = @trackers.reduce({}) do |export, tracker|
        export[tracker.title] = tracker.to_yaml_object; export
      end
      YAML.dump(trackers_export)
    end
120269
def getYamlDocument(filePath):
    
    with open(filePath) as stream:
        doc = yaml.load(stream)
        return doc
1006902
def marshal_load(data)
      values, opts = data
      initialize(values[:id])
      initialize_from(values, opts)
    end
1197722
def _extract_yaml_block(self, indent, fh):
        """"""
        raw_yaml = []
        indent_match = re.compile(r"^{}".format(indent))
        try:
            fh.next()
            while indent_match.match(fh.peek()):
                raw_yaml.append(fh.next().replace(indent, "", 1))
                # check for the end and stop adding yaml if encountered
                if self.yaml_block_end.match(fh.peek()):
                    fh.next()
                    break
        except StopIteration:
            pass
        return "\n".join(raw_yaml)
207409
function yamlTransform (filename) {
  if (!/\.yml|\.yaml$/i.test(filename)) {
    return through()
  }

  return through(function (buf, enc, next) {
    this.push(
      'module.exports=' + JSON.stringify(YAML.parse(buf.toString('utf8')))
    )
    next()
  })
}
121087
def from_string(cls, s):
        """"""
        stream = cStringIO(s)
        stream.seek(0)
        return cls(**yaml.safe_load(stream))
233788
function loadYAMLConfig(configPath) {
  try {
    return safeLoad(readFileSync(configPath, 'utf8'))
  } catch (e) {
    if (e.constructor.name === 'YAMLException') {
      throw e
    }
    log.error({
      message: chalk.red(`Unable to find YML config at "${configPath}".`),
      ref: 'unable-to-find-config',
    })
    return undefined
  }
}
1331625
def parse_yaml(self, y):
        ''''''
        self.name = y['name']
        if RTS_EXT_NS_YAML + 'comment' in y:
            self.comment = y[RTS_EXT_NS_YAML + 'comment']
        if RTS_EXT_NS_YAML + 'visible' in y:
            visible = y.get(RTS_EXT_NS_YAML + 'visible')
            if visible == True or visible == 'true' or visible == 'True':
                self.visible = True
            else:
                self.visible = False
        if RTS_EXT_NS_YAML + 'properties' in y:
            for p in y.get(RTS_EXT_NS_YAML + 'properties'):
                if 'value' in p:
                    value = p['value']
                else:
                    value = None
                self._properties[p['name']] = value
        return self
91932
def get_parsed_context(context_arg):
    """"""
    assert context_arg, ("pipeline must be invoked with context arg set. For "
                         "this yaml parser you're looking for something "
                         "like: "
                         "pypyr pipelinename './myyamlfile.yaml'")
    logger.debug("starting")
    logger.debug(f"attempting to open file: {context_arg}")
    with open(context_arg) as yaml_file:
        yaml_loader = yaml.YAML(typ='safe', pure=True)
        payload = yaml_loader.load(yaml_file)

    logger.debug(f"yaml file parsed. Count: {len(payload)}")

    if not isinstance(payload, MutableMapping):
        raise TypeError("yaml input should describe a dictionary at the top "
                        "level. You should have something like "
                        "\n'key1: value1'\n key2: value2'\n"
                        "in the yaml top-level, not \n'- value1\n - value2'")

    logger.debug("done")
    return payload
1114481
def parse(self, stream, media_type=None, parser_context=None):
        
        assert yaml, 'YAMLParser requires pyyaml to be installed'

        parser_context = parser_context or {}
        encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)

        try:
            data = stream.read().decode(encoding)
            return yaml.safe_load(data)
        except (ValueError, yaml.parser.ParserError) as exc:
            raise ParseError('YAML parse error - %s' % six.text_type(exc))
1254959
def dump(data, stream=None, **kwargs):
    '''
    
    '''
    if 'allow_unicode' not in kwargs:
        kwargs['allow_unicode'] = True
    return yaml.dump(data, stream, **kwargs)
956326
def parse_yaml(self, y):
        '''

        '''
        self._targets = []
        if 'targets' in y:
            for t in y['targets']:
                if 'waitTime' in t['condition']:
                    new_target = WaitTime()
                elif 'preceding' in t['condition']:
                    new_target = Preceding()
                else:
                    new_target = Condition()
                new_target.parse_yaml(t)
                self._targets.append(new_target)
        return self
435930
def yaml_to_param(obj, name):
	
	return from_pyvalue(u"yaml:%s" % name, unicode(yaml.dump(obj)))
844088
def read_object_from_yaml(desired_type: Type[Any], file_object: TextIOBase, logger: Logger,
                          fix_imports: bool = True, errors: str = 'strict', *args, **kwargs) -> Any:
    
    return yaml.load(file_object)
1103700
def parse_yaml(self, y):
        '''

        '''
        self.connector_id = y['connectorId']
        self.name = y['name']
        if 'transMethod' in y:
            self.trans_method = y['transMethod']
        else:
            self.trans_method = ''
        if RTS_EXT_NS_YAML + 'comment' in y:
            self.comment = y[RTS_EXT_NS_YAML + 'comment']
        else:
            self.comment = ''
        if RTS_EXT_NS_YAML + 'visible' in y:
            visible = y[RTS_EXT_NS_YAML + 'visible']
            if visible == True or visible == 'true' or visible == '1':
                self.visible = True
            else:
                self.visible = False
        if 'sourceServicePort' not in y:
            raise InvalidServicePortConnectorNodeError
        self.source_service_port = \
                TargetPort().parse_yaml(y['sourceServicePort'])
        if 'targetServicePort' not in y:
            raise InvalidServicePortConnectorNodeError
        self.target_service_port = \
                TargetPort().parse_yaml(y['targetServicePort'])
        if RTS_EXT_NS_YAML + 'properties' in y:
            for p in y[RTS_EXT_NS_YAML + 'properties']:
                if 'value' in p:
                    value = p['value']
                else:
                    value = None
                self._properties[p['name']] = value
        return self
578347
function stringYAML2YAML (doc, compact = false) {
  if (!doc || typeof doc !== 'string') {
    throw new TypeError('Argument must be a string or object, and not empty: ' + doc)
  }

  let obj = yaml.safeLoad(doc)

  if (!obj || typeof obj !== 'object') {
    throw new TypeError('Argument must be in yaml format: ' + doc)
  }

  return yaml.safeDump(obj, compact ? { 'flowLevel': 0 } : undefined)
}