Parses the client authorization file.

@param  {String}   data     Parsed array of client authorization data
@param  {Function} callback Callback function accepting an error parameter
172666
function parseClientAuth(data, callback) {
  authParser.parseAuth(data, function(err, data) {
    if (err) callback(err, null);
    callback(null, data);
  });
}
179993
function checkResponse(err, data) {
		if (err) {
			return callback(err);
		}

		responseParser.parse(data,
			{ format: this.format, logger: this.logger }, getTokens);
		function getTokens(err, tokenResponse) {
			var accessToken, accessSecret;

			if (err) {
				return callback(err);
			}

			return callback();
		}
	}
1251610
function(id, callback) {
        var self = this;

        var requestOptions = {
            uri: '/images/' + id
        };

        self.authorizedRequest(requestOptions, function(err, res, body) {
            if (err || !body.image) {
                callback(err);
                return;
            }

            callback(err, new rackspace.Image(self, body.image));
        });
    }
610594
function parseResult(text, callback) {
  var errors = [], i = 0, l, errBlock, match, match2, lines;

  text = text.replace(/\r/g, '');
  lines = text.split('\n');

  match = skippingRegex.exec(lines[i]);
  if (match) {
    i++;
  }

  match = successRegex.exec(lines[i]);
  if (match) {
    callback(null, createParseSuccessObj(match));
    return;
  }

  for (l = lines.length; i < l; i++) {
    match = fileRegex.exec(lines[i]);
    if (match) {
      match2 = errorRegex.exec(lines[++i]);
      errBlock = createFailObj(match);
      for (var j = i; match2 && j < lines.length;) {
        errBlock.errors.push(createErrorObj(match2));
        match2 = errorRegex.exec(lines[++j]);
      }
      i = --j;
      errors.push(errBlock);
    } else {
      match = abstractRegex.exec(lines[i]);
      if (match) {
        callback(createErrorGJSLintFailed(match, errors));
        return;
      }
    }
  }
  callback(createParseErrorUnknown(lines));

}
881624
function (callback) {

    "use strict";

    this.filename ="";
    this.lastLine = "";
    this.entries = { };
    this.types = {};
    this.typesRev = {};
    this.callback = callback;


    this.curLine = "";

    this.bad_STEP_file = false;

    this.status = waiting_file_type;

    this.header = []; // un parsed header

}
112992
function (callback) {
            async.map([ "tid.dat.gz", "tid_pos.dat.gz", "tid_map.dat.gz" ], function (filename, _callback) {
                loadArrayBuffer(path.join(dic_path, filename), function (err, buffer) {
                    if(err) {
                        return _callback(err);
                    }
                    _callback(null, buffer);
                });
            }, function (err, buffers) {
                if(err) {
                    return callback(err);
                }
                var token_info_buffer = new Uint8Array(buffers[0]);
                var pos_buffer = new Uint8Array(buffers[1]);
                var target_map_buffer = new Uint8Array(buffers[2]);

                dic.loadTokenInfoDictionaries(token_info_buffer, pos_buffer, target_map_buffer);
                callback(null);
            });
        }
856144
function readAsByteArray(chunk, callback) {
  let reader = new FileReader();
  reader.onload = () => {
    callback(null, new Uint8Array(reader.result));
  };
  reader.onerror = (err) => {
    callback(err);
  };
  reader.readAsArrayBuffer(chunk);
}
309705
function parser(file, callback) {
  // file exit conditions
  if(file.isNull()) {
    return callback(null, file); // pass along
  }

  if(file.isStream()) {
    return callback(new Error('Streaming not supported'));
  }

  try {

    var
      /** @type {string} */
      text     = String(file.contents.toString('utf8')),
      lines    = text.split('\n'),
      filename = file.path.substring(0, file.path.length - 4),
      key      = 'server/documents',
      position = filename.indexOf(key)
    ;

    // exit conditions
    if(!lines) {
      return;
    }
    if(position < 0) {
      return callback(null, file);
    }

    filename = filename.substring(position + key.length + 1, filename.length);

    var
      lineCount = lines.length,
      active    = false,
      yaml      = [],
      categories = [
        'UI Element',
        'UI Global',
        'UI Collection',
        'UI View',
        'UI Module',
        'UI Behavior'
      ],
      index,
      meta,
      line
    ;

    for(index = 0; index < lineCount; index++) {

      line = lines[index];

      // Wait for metadata block to begin
      if(!active) {
        if(startsWith(line, '---')) {
          active = true;
        }
        continue;
      }
      // End of metadata block, stop parsing.
      if(startsWith(line, '---')) {
        break;
      }
      yaml.push(line);
    }


    // Parse yaml.
    meta = YAML.parse(yaml.join('\n'));
    if(meta && meta.type && meta.title && inArray(meta.type, categories) ) {
      meta.category = meta.type;
      meta.filename = filename;
      meta.url      = '/' + filename;
      meta.title    = meta.title;
      // Primary key will by filepath
      data[meta.element] = meta;
    }
    else {
      // skip
      // console.log(meta);
    }


  }

  catch(error) {
    console.log(error, filename);
  }

  callback(null, file);

}
323789
function(data, callback) {
    var json
    try {
        json = JSON.parse(data)
    } catch (exc) {
        return callback(exc)
    }
    callback(null, json)
}
1069937
function Parse(keys){
  if (!keys) return
  this.name = "parse"
  this.keys = keys

  this.initialize = function() {
    Parse = require('node-parse-api').Parse;
    var options = {
        app_id: this.keys.app_id,
        api_key: this.keys.api_key
    }
    debug("initing parse client", options)
    this.client = new Parse(options);
  }

  this.send = function(data, callback) {
    var context = this;
    var parseStat;

    // TODO: should query to make sure installation hasn't been created yet
    context.client.insertInstallationData(data.deviceType, data.deviceToken, function(err, result){

      if (err) {
        parseStat = new ParseErrorStatus(err);
        debug("-_-_ FAILED with parse _-_-");
        debug("insertInstallationData err", err);
        debug(parseStat);
        return callback(parseStat);

      } else { debug("insertInstallationData result", result); }

      var notification = {
        where : {
           "deviceToken": { 
              "$in": [ data.deviceToken ] 
            }
        },
        data: {
          alert: data.message
        }
      };

      context.client.sendPush(notification, function(err, result){
        
        if (err) {
          parseStat = new ParseErrorStatus(err);
          debug("-_-_ FAILED with parse _-_-");
          debug(err);
          debug(parseStat);
          return callback(parseStat);

        } else {
          parseStat = new ParseSuccessStatus(result);
          debug("-_-_ sent with parse _-_-");
          result.service = context;
          result.status = parseStat;
          debug(result);
          return callback(null, result);
        }
      });
    });
  }

  this.initialize()
}
781944
function (req, callback) {
    var authorization = req.headers.authorization.split(' ')
    var scheme = authorization[0]
    var credentials = Buffer.from(authorization[1], 'base64')
      .toString('ascii')
      .split(':')
    var clientId = credentials[0]
    var clientSecret = credentials[1]

    // malformed credentials
    if (credentials.length !== 2) {
      return callback(new AuthorizationError({
        error: 'unauthorized_client',
        error_description: 'Malformed HTTP Basic credentials',
        statusCode: 400
      }))
    }

    // invalid authorization scheme
    if (!/^Basic$/i.test(scheme)) {
      return callback(new AuthorizationError({
        error: 'unauthorized_client',
        error_description: 'Invalid authorization scheme',
        statusCode: 400
      }))
    }

    // missing credentials
    if (!clientId || !clientSecret) {
      return callback(new AuthorizationError({
        error: 'unauthorized_client',
        error_description: 'Missing client credentials',
        statusCode: 400
      }))
    }

    Client.get(clientId, function (err, client) {
      if (err) { return callback(err) }

      // Unknown client
      if (!client) {
        return callback(new AuthorizationError({
          error: 'unauthorized_client',
          error_description: 'Unknown client identifier',
          statusCode: 401
        }))
      }

      // Mismatching secret
      if (client.client_secret !== clientSecret) {
        return callback(new AuthorizationError({
          error: 'unauthorized_client',
          error_description: 'Mismatching client secret',
          statusCode: 401
        }))
      }

      callback(null, client)
    })
  }
886791
private void parseH2Authority(byte[] data) {
        if (data.length == 0) {
            throw new IllegalArgumentException("Invalid authority: " + GenericUtils.getEnglishString(data));
        }
        int i = 0;
        int host_start = i;
        for (; i < data.length; i++) {
            // find either a "@" or "/"
            if ('@' == data[i]) {
                // Note: we're just cutting off the userinfo section for now
                host_start = i + 1;
            }
        }
        parseURLHost(data, host_start, data.length);
    }
611876
function parseData(data)
{
    var tmp_data = {};
    if (nlib.isString(data)) {
        if (data.match(/\.json/i) && grunt.file.exists(data)) {
          tmp_data = grunt.file.readJSON(data);
        } else if (data.match(/\.ya?ml/i) && grunt.file.exists(data)) {
          tmp_data = grunt.file.readYAML(data);
        } else {
            tmp_data = data;
        }
    } else if (nlib.isObject(data) || nlib.isArray(data)) {
        for (var i in data) {
            if (nlib.isString(data[i])) {
                var parsed = parseData(data[i]);
                if (nlib.isString(parsed)) {
                    tmp_data[i] = parsed;
                } else {
                    tmp_data = merge(tmp_data, parsed);
                }
            } else {
                tmp_data = merge(tmp_data, data[i]);
            }
        }
    }
    return tmp_data;
}
1139857
function readFile (file, callback) {
  var schema = file.schema;
  file[__internal].state = STATE_READING;

  if (schema.config.sync) {
    schema.plugins.readFileSync({ file: file });
    doneReading(null);
  }
  else {
    schema.plugins.readFileAsync({ file: file }, doneReading);
  }

  function doneReading (err) {
    if (err) {
      callback(err);
    }
    else {
      file[__internal].state = STATE_READ;
      safeCall(decodeFile, file, callback);
    }
  }
}
1305093
function writeFile(callback) {
        var s = JSON.stringify(images);

        fs.writeFile('imageData.json', s, function (err) {
          if (err) return console.log(err);
          else
            { 
            console.log("success");
            if (callback) callback.call(this, images);
            }
        });


    }
164868
function _loadFile(filename, callback) {
    callback = callback || function () { };

    if (filename.charAt(0) == '.') {
      callback();
      return;
    }

    var filepath = path.join(folder, filename);
    fs.readFile(filepath, function (err, data) {
      if (err) {
        console.error('Failed to read file ' + filepath + ' err:', err);
        callback(err);
        return;
      }
      try {
        _loadData(filename, data.toString());
      }
      catch (e) {
        console.info('Object ' + filename + ' was not yet fully written, exception:', e);
        // There will be another notification of change when the last write to file is completed.
        // Meanwhile leave the previous value.
        if (loader) {
          // Store this error to wait until file will be successfully loaded for the 1st time.
          loader.errors[filename] = e;
        }
        // Don't return error to continue asynchronous loading of other files. Errors are assembled on loader.
        callback();
        return;
      }
      console.log('Loaded ' + filename);
      if (loader) {
        if (loader.errors[filename]) {
          // File that previously failed to load, now is loaded.
          delete loader.errors[filename];
          var countErrors = Object.keys(loader.errors).length;
          if (countErrors === 0) {
            // All errors are fixed. This is the time to complete loading.
            var initcb = loader.callback;
            loader = null;
            _updateSingleton();
            initcb();
          }
        }
      }
      callback();
    });
  }
302029
function (req, callback) {
    var params = req.body
    var clientId = params.client_id
    var clientSecret = params.client_secret

    // missing credentials
    if (!clientId || !clientSecret) {
      return callback(new AuthorizationError({
        error: 'unauthorized_client',
        error_description: 'Missing client credentials',
        statusCode: 400
      }))
    }

    Client.get(clientId, function (err, client) {
      if (err) { return callback(err) }

      // Unknown client
      if (!client) {
        return callback(new AuthorizationError({
          error: 'unauthorized_client',
          error_description: 'Unknown client identifier',
          statusCode: 401
        }))
      }

      // Mismatching secret
      if (client.client_secret !== clientSecret) {
        return callback(new AuthorizationError({
          error: 'unauthorized_client',
          error_description: 'Mismatching client secret',
          statusCode: 401
        }))
      }

      callback(null, client)
    })
  }