Retrieve the possible locations of the license information.

@param {Object} data The package.json or npm package contents.
@returns {Array}
@api private
552770
function get(data) {
    var parser = this
      , matches = [];

    //
    // Another npm oddity, it allows licenses to be specified in to different
    // properties. Because why the fuck not?
    //
    ['license', 'licenses'].forEach(function each(key) {
      if ('string' === typeof data[key]) {
        return matches.push(data[key]);
      }

      if (Array.isArray(data[key])) {
        return Array.prototype.push.apply(
          matches,
          data[key].map(function map(item) {
            return parser.license(item);
          }).filter(Boolean)
        );
      }

      if ('object' === typeof data[key] && parser.license(data[key])) {
        return Array.prototype.push.apply(
          matches,
          [parser.license(data[key])]
        );
      }
    });

    if (matches.length) return matches;
  }
121802
function getPackageMetaFile(answers) {
    const packageFields = ['name', 'version', 'license', 'category'];
    const packageObject = merge(pick(packageFields, answers),
        { dependencies: { 'rung-cli': '1.0.0' } });

    return {
        filename: path.join(answers.name, 'package.json'),
        content: JSON.stringify(packageObject, null, 2)
    };
}
1171422
def data(self, index, role=Qt.DisplayRole):
        """"""
        if not index.isValid() or not 0 <= index.row() < len(self._rows):
            return to_qvariant()

        row = index.row()
        column = index.column()

        P = self._palette

        if self._rows[row] == row:
            action = C.ACTION_NONE
            type_ = u''
            name = u''
            description = u''
            version = u'-'
            status = -1
            # url = u''
            # license_ = u''
            i = False
            r = False
            u = False
            d = False
            # action_version = None
        else:
            action = self._rows[row][C.COL_ACTION]
            type_ = self._rows[row][C.COL_PACKAGE_TYPE]
            name = self._rows[row][C.COL_NAME]
            description = self._rows[row][C.COL_DESCRIPTION]
            version = self._rows[row][C.COL_VERSION]
            status = self._rows[row][C.COL_STATUS]
            # url = self._rows[row][C.COL_URL]
            # license_ = self._rows[row][C.COL_LICENSE]
            i = self._rows[row][C.COL_INSTALL]
            r = self._rows[row][C.COL_REMOVE]
            u = self._rows[row][C.COL_UPGRADE]
            d = self._rows[row][C.COL_DOWNGRADE]
            # action_version = self._rows[row][C.COL_ACTION_VERSION]

        is_upgradable = self.is_upgradable(self.index(row, C.COL_VERSION))
#        if is_upgradable:
#            version += C.UPGRADE_SYMBOL

        if role == Qt.DisplayRole:
            if column == C.COL_PACKAGE_TYPE:
                return to_qvariant(type_)
            if column == C.COL_NAME:
                return to_qvariant(name)
            elif column == C.COL_VERSION:
                return to_qvariant(version)
            elif column == C.COL_STATUS:
                return to_qvariant(status)
            elif column == C.COL_DESCRIPTION:
                return to_qvariant(description)
            elif column == C.COL_ACTION:
                return to_qvariant(action)
        elif role == Qt.BackgroundRole:
            if action == C.ACTION_REMOVE:
                return to_qvariant(P['background.remove'])
            elif action == C.ACTION_INSTALL:
                return to_qvariant(P['background.install'])
            elif action == C.ACTION_UPGRADE:
                return to_qvariant(P['background.upgrade'])
            elif action == C.ACTION_DOWNGRADE:
                return to_qvariant(P['background.downgrade'])
        elif role == Qt.TextAlignmentRole:
            if column in [C.COL_NAME, C.COL_DESCRIPTION]:
                return to_qvariant(int(Qt.AlignLeft | Qt.AlignVCenter))
            elif column in [C.COL_VERSION] and is_upgradable:
                return to_qvariant(int(Qt.AlignLeft | Qt.AlignVCenter))
            # else:
            #     return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter))
        elif role == Qt.DecorationRole:
            if column == C.COL_ACTION:
                if action == C.ACTION_NONE:
                    if status == C.NOT_INSTALLED:
                        return to_qvariant(P['icon.action.not_installed'])
                    elif status in [C.UPGRADABLE, C.MIXGRADABLE]:
                        return to_qvariant(P['icon.action.installed'])
                    elif status in [C.INSTALLED, C.DOWNGRADABLE,
                                    C.MIXGRADABLE]:
                        return to_qvariant(P['icon.action.installed'])
                elif action == C.ACTION_INSTALL:
                    return to_qvariant(P['icon.action.add'])
                elif action == C.ACTION_REMOVE:
                    return to_qvariant(P['icon.action.remove'])
                elif action == C.ACTION_UPGRADE:
                    return to_qvariant(P['icon.action.upgrade'])
                elif action == C.ACTION_DOWNGRADE:
                    return to_qvariant(P['icon.action.downgrade'])
                else:
                    return to_qvariant()
            elif column == C.COL_PACKAGE_TYPE:
                if type_ == C.CONDA_PACKAGE:
                    return to_qvariant(P['icon.anaconda'])
                elif type_ == C.PIP_PACKAGE:
                    return to_qvariant(P['icon.python'])
                else:
                    return to_qvariant()
            elif column == C.COL_INSTALL:
                if status == C.NOT_INSTALLED:
                    if i:
                        return to_qvariant(P['icon.add.pressed'])
                    else:
                        return to_qvariant(P['icon.add.active'])
                elif (status == C.INSTALLED or
                      status == C.UPGRADABLE or
                      status == C.DOWNGRADABLE or
                      status == C.MIXGRADABLE):
                    if r:
                        return to_qvariant(P['icon.remove.pressed'])
                    else:
                        return to_qvariant(P['icon.remove.active'])
                else:
                    return to_qvariant(P['icon.add.inactive'])
            elif column == C.COL_REMOVE:
                if (status == C.INSTALLED or
                    status == C.UPGRADABLE or
                    status == C.DOWNGRADABLE or
                   status == C.MIXGRADABLE):
                    if r:
                        return to_qvariant(P['icon.remove.pressed'])
                    else:
                        return to_qvariant(P['icon.remove.active'])
                else:
                    return to_qvariant(P['icon.remove.inactive'])
            elif column == C.COL_UPGRADE:
                if status == C.UPGRADABLE or \
                  status == C.MIXGRADABLE:
                    if u:
                        return to_qvariant(P['icon.upgrade.pressed'])
                    else:
                        return to_qvariant(P['icon.upgrade.active'])
                else:
                    return to_qvariant(P['icon.upgrade.inactive'])
            elif column == C.COL_DOWNGRADE:
                if status == C.DOWNGRADABLE or \
                  status == C.MIXGRADABLE:
                    if d:
                        return to_qvariant(P['icon.downgrade.pressed'])
                    else:
                        return to_qvariant(P['icon.downgrade.active'])
                else:
                    return to_qvariant(P['icon.downgrade.inactive'])
            elif column == C.COL_VERSION:
                if is_upgradable:
                    return to_qvariant(P['icon.upgrade.arrow'])
                else:
                    return to_qvariant(P['spacer'])
        elif role == Qt.ToolTipRole:
            if column == C.COL_INSTALL and status == C.NOT_INSTALLED:
                return to_qvariant(_('Install package'))
            elif column == C.COL_INSTALL and (status == C.INSTALLED or
                                              status == C.UPGRADABLE or
                                              status == C.DOWNGRADABLE or
                                              status == C.MIXGRADABLE):
                return to_qvariant(_('Remove package'))
            elif column == C.COL_UPGRADE and (status == C.INSTALLED or
                                              status == C.UPGRADABLE or
                                              status == C.MIXGRADABLE):
                return to_qvariant(_('Upgrade package'))
            elif column == C.COL_DOWNGRADE and (status == C.INSTALLED or
                                                status == C.DOWNGRADABLE or
                                                status == C.MIXGRADABLE):
                return to_qvariant(_('Downgrade package'))
            elif column == C.COL_PACKAGE_TYPE:
                if type_ == C.CONDA_PACKAGE:
                    return to_qvariant(_('Conda package'))
                elif type_ == C.PIP_PACKAGE:
                    return to_qvariant(_('Python package'))
            elif column == C.COL_VERSION:
                if is_upgradable:
                    return to_qvariant(_('Update available'))
        elif role == Qt.ForegroundRole:
            palette = QPalette()
            if column in [C.COL_NAME, C.COL_DESCRIPTION]:
                if status in [C.INSTALLED, C.UPGRADABLE, C.DOWNGRADABLE,
                              C.MIXGRADABLE]:
                    color = palette.color(QPalette.WindowText)
                    return to_qvariant(color)
                elif status in [C.NOT_INSTALLED]:
                    color = palette.color(QPalette.Mid)
                    color = P['foreground.not.installed']
                    return to_qvariant(color)
            elif column in [C.COL_VERSION]:
                if is_upgradable:
                    return to_qvariant(P['foreground.upgrade'])

        elif role == Qt.SizeHintRole:
            if column in [C.ACTION_COLUMNS] + [C.COL_PACKAGE_TYPE]:
                return to_qvariant(QSize(24, 24))

        return to_qvariant()
294850
function getPackageInfoFrom(string) {
  if (string[0] === '@') {
    const [scope, rawName] = string.split('/');
    const { name, version } = getVersionFromString(rawName);
    return {
      name: `${scope}/${name}`,
      version,
    };
  }

  return getVersionFromString(string);
}
163259
function doSlimGrap(data, options) {
	var bundles = data.bundles.slice(0);

	var slimmedBundles = slimGraph({
		graph: data.graph,
		mains: data.mains,
		bundles: bundles,
		target: options.target,
		baseUrl: data.loader.baseURL,
		slimConfig: data.loader.slimConfig,
		splitLoader: data.options.splitLoader,
		bundlesPath: data.configuration.bundlesPath,
		configMain: data.loader.configMain || "package.json!npm",
		progressiveBundles: getProgressiveBundles(data.loader, data.graph)
	});

	return assign(
		{},
		omit(data, ["bundles"]),
		{ bundles: slimmedBundles }
	);
}
130774
function(data) {
    return Promise.each(normalizer(data), function(datum) {
      return Promise.retry(function() {
        if (getId(datum)) {
          return docker.stop(getId(datum));
        }
        else if (datum.compose) {
          return compose.stop(datum.compose, datum.project, datum.opts);
        }
      });
    });
  }
398851
function extractFixturesData( data ) {
    return Promise.map( data.section(), function( section ) {
      var markup  = section.markup();
      var ext     = path.extname( markup );
      var testDir = data.data.files[0].split("/")
            .filter(function(dir, i) {
              return i <= 2;
            })
            .concat([path.dirname( markup ), (path.basename( markup, ext ) + ext) ])
            .join('/');
  
      return Promise.props({
        header : section.header(),
        description : section.description(),
        markup : fs.readFileAsync( testDir, 'utf8' ).then( mustache.render ),
        name : path.basename( section.markup(), path.extname( section.markup() ) )
      });
   });
  }
263929
function normalize( pkgs, data ) {
	var keys;
	var tmp;
	var i;

	// {"error":"..."} || {"status":404,"message":"..."}
	if ( data.error || data.status === 404 ) {
		tmp = {};
		for ( i = 0; i < pkgs.length; i++ ) {
			tmp[ pkgs[ i ] ] = null;
		}
		data = tmp;
	}
	// {"downloads":[...],"package":"..."}
	else if ( data.package ) {
		tmp = {};
		tmp[ data.package ] = data;
		data = tmp;
	}
	// Check for packages missing from the results...
	keys = getKeys( data );
	if ( keys.length !== pkgs.length ) {
		for ( i = 0; i < pkgs.length; i++ ) {
			if ( data[ pkgs[i] ] === void 0 ) {
				data[ pkgs[i] ] = null;
			}
		}
	}
	return data;
}
229016
function () {
  var shrinkWrapPath = path.resolve(process.cwd(), 'npm-shrinkwrap.json');
  if (fs.existsSync(shrinkWrapPath)) {
    logger.logInfo('[npm] using npm-shrinkwrap.json instead of package.json');
    return shrinkWrapPath;
  }

  if (getNpmMajorVersion() >= 5) {
      var packageLockPath = path.resolve(process.cwd(), 'package-lock.json');
      if (fs.existsSync(packageLockPath)) {
          logger.logInfo('[npm] using package-lock.json instead of package.json');
          return packageLockPath;
      }
  }

  var packagePath = path.resolve(process.cwd(), 'package.json');
  return packagePath;
}
1120404
function generateLicenseAndVersionInfo() {
    var pkg = require(path.join(__dirname, '..', 'package.json'));
    var today = moment().format('YYYY-MM-DD');
    return {
        licenceComment: '/*!' + pkg.name + ' v' + pkg.version + ' ' + today + '*/\n',
        versionInfo: pkg.version + ' ' + today
    };
}
780767
async function fetch(
  serviceInstance,
  { baseUrl, packageName, includePrereleases = false }
) {
  const json = await serviceInstance._requestJson({
    schema,
    url: await searchQueryServiceUrl(baseUrl),
    options: {
      qs: {
        q: `packageid:${encodeURIComponent(packageName.toLowerCase())}`,
        // Include prerelease versions.
        prerelease: 'true',
        // Include packages with SemVer 2 version numbers.
        semVerLevel: '2',
      },
    },
  })

  if (json.data.length === 1) {
    return json.data[0]
  } else {
    throw new NotFound({ prettyMessage: 'package not found' })
  }
}
1136029
function extractDestData(data) {

	if (destinationConfigExists(data)) {
		if (data.dest instanceof Object) {
			return extractMultiDestValues(data.dest);
		}
		else {
			return extractBackportDestination(data.dest);
		}
	}

	return [];
}
1058638
function (aLibsData) {
				var oLibItem,
					iLen,
					i;

				// Find entity in loaded libs data
				for (i = 0, iLen = aLibsData.length; i < iLen; i++) {
					oLibItem = aLibsData[i];
					if (oLibItem.name === this._sTopicid) {
						// Check if we are allowed to display the requested symbol
						// BCP: 1870269087 item may not have visibility info at all. In this case we show the item
						if (oLibItem.visibility === undefined || this._aAllowedMembers.indexOf(oLibItem.visibility) >= 0) {
							return oLibItem;
						} else {
							// We found the requested symbol but we are not allowed to show it.
							return Promise.reject(this.NOT_FOUND);
						}
					}
				}

				// If we are here - the object does not exist so we reject the promise.
				return Promise.reject(this.NOT_FOUND);
			}
227585
function findProjectRoot(currentPath) {
  var result = undefined;

  try {
    var packageStats = lstatSync(path.join(currentPath, 'package.json'));

    if (packageStats.isFile()) {
      result = currentPath;
    }
  } catch (error) {
    if (currentPath !== path.resolve('/')) {
      result = findProjectRoot(path.join(currentPath, '..'));
    }
  }

  return result;
}
1134952
function (data) {
        var that = this,
            restrictedKeys = [],
            unrestrictedData = {},
            maxSpecificity = -1;

        // Find most specific location that could restrict current data
        collection_util.each(that.constraints, function (constraint, id) {
            collection_util.each(constraint.locations, function (location, i) {
                if (location.containsData(data) && location.specificity > maxSpecificity) {
                    maxSpecificity = location.specificity;
                }
            });
        });

        if (maxSpecificity >= 0) {

            // Для городов-регионов нужно также отсечь и город
            if (data.region_kladr_id && data.region_kladr_id === data.city_kladr_id) {
                restrictedKeys.push.apply(restrictedKeys, that.type.dataComponentsById['city'].fields);
            }

            // Collect all fieldnames from all restricted components
            collection_util.each(that.type.dataComponents.slice(0, maxSpecificity + 1), function (component, i) {
                restrictedKeys.push.apply(restrictedKeys, component.fields);
            });

            // Copy skipping restricted fields
            collection_util.each(data, function (value, key) {
                if (restrictedKeys.indexOf(key) === -1) {
                    unrestrictedData[key] = value;
                }
            });
        } else {
            unrestrictedData = data;
        }

        return unrestrictedData;
    }
1148115
def license_contents
      matched_files.reject { |f| f == package_file }
                   .group_by(&:content)
                   .map { |content, files| { "sources" => license_content_sources(files), "text" => content } }
    end
1333818
function matchLicense (licenseString) {
  // Find all textual matches on license text.
  var normalized = normalizeText(licenseString)
  var matchingLicenses = []

  var license

  // Check matches of normalized license content against signatures.
  for (var i = 0; i < licenses.length; i++) {
    license = licenses[i]
    var match = false
    for (var j = 0; j < license.signatures.length; j++) {
      if (normalized.indexOf(license.signatures[j]) >= 0) {
        match = true
        break
      }
    }
    if (match) {
      matchingLicenses.push(license)
    }
  }
  // For single-line license, check if it's a known license id.
  if (matchingLicenses.length === 0 && !/[\n\f\r]/.test(licenseString) && licenseString.length < 100) {
    var licenseName = normalizeText(licenseString)
    // If there's an extra "license" on the end of the name, drop it ("MIT License" -> "MIT").
    license = licenseIndex[licenseName] || licenseIndex[licenseName.replace(/ licen[sc]e$/, '')]
    if (!license) {
      license = {name: licenseName, id: null}
    }
    matchingLicenses.push(license)
  }
  if (matchingLicenses.length === 0) {
    return null
  }
  if (matchingLicenses.length > 1) {
    console.warn('Multiple matching licenses: ' + matchingLicenses.length, [licenseString, matchingLicenses])
  }
  return matchingLicenses[0]
}