Get the release type of a package (stable / testing)

@param string $package_name

@return string|null
180268
public function getReleaseType($package_name)
    {
        $repository = $this->repository['plugins'];
        if (isset($repository[$package_name])) {
            return $repository[$package_name]->release_type;
        }

        //Not a plugin, it's a theme?
        $repository = $this->repository['themes'];
        if (isset($repository[$package_name])) {
            return $repository[$package_name]->release_type;
        }

        return null;
    }
1051288
public function checkPackagesCanBeInstalled($packages_names_list)
    {
        foreach ($packages_names_list as $package_name) {
            $this->checkNoOtherPackageNeedsThisDependencyInALowerVersion($package_name,
                $this->getLatestVersionOfPackage($package_name), $packages_names_list);
        }
    }
639763
protected function package($name)
    {
        $package = $this->obtainPackage($name);

        if ($package == -1) {
            return;
        }

        list($name, $providers, $aliases, $after) = array_fill(0, 4, null);
        extract($package, EXTR_IF_EXISTS);

        $this->requireComposerPackage($name);

        if ($this->setupLaravelConfigFile($providers, $aliases) == -1) {
            return -1;
        }

        $this->executeScriptAfterPackageInstallation($after);
    }
829891
public function searchPackages($name)
    {
        try {
            $url = $this->config->getBasePackagesUrl() . 'search/' . $name;
            $response = $this->githubClient->getHttpClient()->get($url);

            return json_decode($response->getBody(true), true);
        } catch (RequestException $e) {
            throw new RuntimeException(sprintf('Cannot get package list from %s.', str_replace('/packages/', '', $this->config->getBasePackagesUrl())));
        }
    }
1000235
def find_best_candidate(
        self,
        package_name,  # type: str
        target_package_version=None,  # type:  Union[str, None]
        allow_prereleases=False,  # type: bool
    ):  # type: (...) -> Union[Package, bool]
        
        if target_package_version:
            constraint = parse_constraint(target_package_version)
        else:
            constraint = parse_constraint("*")

        candidates = self._pool.find_packages(
            package_name, constraint, allow_prereleases=allow_prereleases
        )

        if not candidates:
            return False

        dependency = Dependency(package_name, constraint)

        # Select highest version if we have many
        package = candidates[0]
        for candidate in candidates:
            if candidate.is_prerelease() and not dependency.allows_prereleases():
                continue

            # Select highest version of the two
            if package.version < candidate.version:
                package = candidate

        return package
1297199
protected function getStabilityInt($name)
    {
        $name = VersionParser::normalizeStability($name);
        return isset(BasePackage::$stabilities[$name]) ?
            BasePackage::$stabilities[$name] :
            BasePackage::STABILITY_STABLE;
    }
182429
def get_version(package_name, ignore_cache=False):
    
    if ignore_cache:
        with microcache.temporarily_disabled():
            found = helpers.regex_in_package_file(
                VERSION_SET_REGEX, '_version.py', package_name, return_match=True
            )
    else:
        found = helpers.regex_in_package_file(
            VERSION_SET_REGEX, '_version.py', package_name, return_match=True
        )
    if found is None:
        raise ProjectError('found {}, but __version__ is not defined')
    current_version = found['version']
    return current_version
1340032
def package_releases(self, project_name):
        
        try:
            return self._connection.package_releases(project_name)
        except Exception as err:
            raise PyPIClientError(err)
996506
public function getPackageInfo($packageName)
    {
        $composerLock = json_decode($this->finder->get('composer.lock'));
        foreach ($composerLock->packages as $package) {
            if ($package->name == $packageName) {
                return $package;
            }
        }
    }
1362246
protected static function loadPackageData()
    {
        if ( ! is_file( static::PACKAGE_FILE ) )
        {
            return null;
        }

        if ( null === static::$packageData )
        {
            static::$packageData = static::loadJsonData( static::PACKAGE_FILE );
        }

        return static::$packageData;
    }
928185
protected function getParentClass(PackageClass $package_class)
    {
        try {
            $base_class = new \ReflectionClass($package_class->getName());
        } catch (\ReflectionException $e) {
            return null;
        }
        if (false === ($parent_reflection = $base_class->getParentClass())
            || dirname($parent_reflection->getFileName()) !== dirname($base_class->getFileName())
        ) {
            return null;
        }

        return new PackageClass($parent_reflection->getName(), $parent_reflection->getFileName());
    }
1178352
def check(self, package_name, package_version, **extra_data):
        """"""
        data = extra_data
        data['package_name'] = package_name
        data['package_version'] = package_version
        data['python_version'] = sys.version.split()[0]
        data['platform'] = platform.platform(True) or 'Unspecified'

        try:
            headers = {'connection': 'close',
                       'content-type': 'application/json'}
            response = requests.put(self.url, json.dumps(data), timeout=1,
                                    headers=headers)
            if response.status_code == codes.UNPROCESSABLE_ENTITY:
                return 'update_checker does not support {!r}'.format(
                    package_name)
            data = response.json()
        except (requests.exceptions.RequestException, ValueError):
            return None

        if not data or not data.get('success') \
                or (parse_version(package_version) >=
                    parse_version(data['data']['version'])):
            return None

        return UpdateResult(package_name, running=package_version,
                            available=data['data']['version'],
                            release_date=data['data']['upload_time'])
427181
public static function getInstalledVersion($package)
    {
        $composer = ComposerInformation::getLock();

        $data = ArrayHelper::query($composer['packages'], ['name' => $package]);

        if (isset($data[0]['version'])) {
            return $data[0]['version'];
        }

        return null;
    }
1369693
protected function getOperationPackage(PackageEvent $event)
    {
        $operation = $event->getOperation();
        if ($operation instanceof UpdateOperation) {
            return $operation->getTargetPackage();
        }
        if ($operation instanceof InstallOperation) {
            return $operation->getPackage();
        }
        return null;
    }
1213182
public function getPackage($name)
    {
        return isset($this->packages[$name = strtolower($name)]) ? $this->packages[$name] : null;
    }
947471
public function get($name)
    {
        if (!isset($this->packages[$name])) {
            return null;
        }

        return $this->packages[$name];
    }
372904
String getPackage() {
        if (this.packageName != null)
            return this.packageName;
        if (this.parent != null)
            return this.parent.getPackage();
        return null;
    }