Does the package have author information listed?
    :param package_info: package_info dictionary
    :return: Tuple (is the condition True or False?, reason if it is False else None)
515327
def check_author_info(package_info, *args):
    
    reason = "Author name or email missing"
    result = False

    if package_info.get('author') not in BAD_VALUES or package_info.get('author_email') not in BAD_VALUES:
        result = True

    return result, reason, HAS_AUTHOR_INFO
559317
def repositories(self):
        
        if self.repo == "sbo":
            self.sbo_case_insensitive()
            self.find_pkg = sbo_search_pkg(self.name)
            if self.find_pkg:
                self.dependencies_list = Requires(self.flag).sbo(self.name)
        else:
            PACKAGES_TXT = Utils().read_file(
                self.meta.lib_path + "{0}_repo/PACKAGES.TXT".format(self.repo))
            self.names = Utils().package_name(PACKAGES_TXT)
            self.bin_case_insensitive()
            self.find_pkg = search_pkg(self.name, self.repo)
            if self.find_pkg:
                self.black = BlackList().packages(self.names, self.repo)
                self.dependencies_list = Dependencies(
                    self.repo, self.black).binary(self.name, self.flag)
1160694
def get_release_id(self, package_name: str, version: str) -> bytes:
        
        validate_package_name(package_name)
        validate_package_version(version)
        self._validate_set_registry()
        return self.registry._get_release_id(package_name, version)
534054
def is_package_installed(distribution, pkg):
    
    if ('centos' in distribution or
            'el' in distribution or
            'redhat' in distribution):
        return(is_rpm_package_installed(pkg))

    if ('ubuntu' in distribution or
            'debian' in distribution):
        return(is_deb_package_installed(pkg))
482619
def get_metadata(item):
    
    for metadata_key in ('METADATA', 'PKG-INFO'):
        try:
            metadata_lines = item.get_metadata_lines(metadata_key)
            break
        except (KeyError, IOError):
            # The package will be shown in the report without any license information
            # if a metadata key is not found.
            metadata_lines = []

    return metadata_lines
218384
def determine_package_type(filename, args):
    
    if args.package_type:
        package_type = args.package_type
    else:
        logger.info('Detecting file type...')

        package_type = detect_package_type(filename)

        if package_type is None:
            message = 'Could not detect package type of file %r please specify package type with option --package-type' % filename
            logger.error(message)
            raise errors.BinstarError(message)

        logger.info('File type is "%s"', package_type)

    return package_type
964784
def list_packages(conn=None):
    '''
    
    '''
    close = False
    if conn is None:
        close = True
        conn = init()

    ret = []
    data = conn.execute('SELECT package FROM packages')
    for pkg in data.fetchall():
        ret.append(pkg)

    if close:
        conn.close()
    return ret
898793
public static boolean isPackageInstalled(Context context, String packageName) {
		try {
			context.getPackageManager().getApplicationInfo(packageName, 0);
			return true;
		} catch (Exception e) {
			return false;
		}
	}
706257
def package_username(repo):
    '''
        

    '''
    package = repo.replace('-', '_')
    username = repo.split('-')[1]
    return package, username
1228042
def info(package, conn=None):
    '''
    
    '''
    close = False
    if conn is None:
        close = True
        conn = init()

    fields = (
        'package',
        'version',
        'release',
        'installed',
        'os',
        'os_family',
        'dependencies',
        'os_dependencies',
        'os_family_dependencies',
        'summary',
        'description',
    )
    data = conn.execute(
        'SELECT {0} FROM packages WHERE package=?'.format(','.join(fields)),
        (package, )
    )
    row = data.fetchone()
    if close:
        conn.close()
    if not row:
        return None

    formula_def = dict(list(zip(fields, row)))
    formula_def['name'] = formula_def['package']

    return formula_def
279678
def check_license(package_info, *args):
    
    classifiers = package_info.get('classifiers')
    reason = "No License"
    result = False

    if len([c for c in classifiers if c.startswith('License ::')]) > 0:
        result = True

    return result, reason, HAS_LICENSE
27570
def item_author_name(self, item):
        
        if item.authors.count():
            self.item_author = item.authors.all()[0]
            return self.item_author.__str__()
804030
def check_release_files(package_info, *args):
    
    reason = "No release files uploaded"
    result = False

    release_urls = args[0]
    if len(release_urls) > 0:
        result = True

    return result, reason, HAS_RELEASE_FILES
1207448
def __list_package_updates(package_name, version):
    

    updates = get_package_update_list(package_name, version)

    if updates['newer_releases'] or updates['pre_releases']:
        print('%s (%s)' % (package_name, version))
        __list_updates('Major releases', updates['major_updates'])
        __list_updates('Minor releases', updates['minor_updates'])
        __list_updates('Patch releases', updates['patch_updates'])
        __list_updates('Pre releases', updates['pre_release_updates'])
        __list_updates('Unknown releases', updates['non_semantic_versions'])
        print("___")
805827
def _check_all_deps(self, pkg_name=None, pkg_file=None, formula_def=None):
        '''
        
        '''
        if pkg_file and not os.path.exists(pkg_file):
            raise SPMInvocationError('Package file {0} not found'.format(pkg_file))

        self.repo_metadata = self._get_repo_metadata()
        if not formula_def:
            for repo in self.repo_metadata:
                if not isinstance(self.repo_metadata[repo]['packages'], dict):
                    continue
                if pkg_name in self.repo_metadata[repo]['packages']:
                    formula_def = self.repo_metadata[repo]['packages'][pkg_name]['info']

        if not formula_def:
            raise SPMInvocationError('Unable to read formula for {0}'.format(pkg_name))

        # Check to see if the package is already installed
        pkg_info = self._pkgdb_fun('info', pkg_name, self.db_conn)
        pkgs_to_install = []
        if pkg_info is None or self.opts['force']:
            pkgs_to_install.append(pkg_name)
        elif pkg_info is not None and not self.opts['force']:
            raise SPMPackageError(
                'Package {0} already installed, not installing again'.format(formula_def['name'])
            )

        optional_install = []
        recommended_install = []
        if 'dependencies' in formula_def or 'optional' in formula_def or 'recommended' in formula_def:
            self.avail_pkgs = {}
            for repo in self.repo_metadata:
                if not isinstance(self.repo_metadata[repo]['packages'], dict):
                    continue
                for pkg in self.repo_metadata[repo]['packages']:
                    self.avail_pkgs[pkg] = repo

            needs, unavail, optional, recommended = self._resolve_deps(formula_def)

            if unavail:
                raise SPMPackageError(
                    'Cannot install {0}, the following dependencies are needed:\n\n{1}'.format(
                        formula_def['name'], '\n'.join(unavail))
                )

            if optional:
                optional_install.extend(optional)
                for dep_pkg in optional:
                    pkg_info = self._pkgdb_fun('info', formula_def['name'])
                    msg = dep_pkg
                    if isinstance(pkg_info, dict):
                        msg = '{0} [Installed]'.format(dep_pkg)
                    optional_install.append(msg)

            if recommended:
                recommended_install.extend(recommended)
                for dep_pkg in recommended:
                    pkg_info = self._pkgdb_fun('info', formula_def['name'])
                    msg = dep_pkg
                    if isinstance(pkg_info, dict):
                        msg = '{0} [Installed]'.format(dep_pkg)
                    recommended_install.append(msg)

            if needs:
                pkgs_to_install.extend(needs)
                for dep_pkg in needs:
                    pkg_info = self._pkgdb_fun('info', formula_def['name'])
                    msg = dep_pkg
                    if isinstance(pkg_info, dict):
                        msg = '{0} [Installed]'.format(dep_pkg)

        return pkgs_to_install, optional_install, recommended_install
1261354
def check_metadata(self):
        
        metadata = self.distribution.metadata

        missing = []
        for attr in ("name", "version", "url"):
            if not (hasattr(metadata, attr) and getattr(metadata, attr)):
                missing.append(attr)

        # https://www.python.org/dev/peps/pep-0345/
        # author or maintainer must be specified
        # author is preferred; if identifcal, specify only author
        if not metadata.author and not metadata.maintainer:
            missing.append("author")
            if self.enforce_email:
                missing.append("author_email")
        else:
            # one or both of author or maintainer specified
            if (
                metadata.author
                and self.enforce_email
                and not metadata.author_email
            ):
                missing.append("author_email")
            if (
                metadata.maintainer
                and self.enforce_email
                and not metadata.maintainer_email
            ):
                missing.append("maintainer_email")
            if (
                metadata.author
                and metadata.maintainer
                and metadata.author == metadata.maintainer
            ):
                self.warn(
                    "Maintainer should be omitted if identical to Author.\n"
                    "See https://www.python.org/dev/peps/pep-0345/"
                    "#maintainer-email-optional"
                )
            if (
                metadata.author_email
                and metadata.maintainer_email
                and metadata.author_email == metadata.maintainer_email
            ):
                self.warn(
                    "Maintainer Email should be omitted if"
                    "identical to Author's.\n"
                    "See https://www.python.org/dev/peps/pep-0345/"
                    "#maintainer-email-optional"
                )

        if missing:
            self.warn("missing required meta-data: %s" % ", ".join(missing))
1217182
def have_correct_lambda_package_version(self, package_name, package_version):
        
        lambda_package_details = lambda_packages.get(package_name, {}).get(self.runtime)

        if lambda_package_details is None:
            return False

        # Binaries can be compiled for different package versions
        # Related: https://github.com/Miserlou/Zappa/issues/800
        if package_version != lambda_package_details['version']:
            return False

        return True