Returns a dictionary containing a boolean specifying whether NumPy
    is up-to-date, along with the version string (empty string if
    not installed).
557422
def get_numpy_status():
    
    numpy_status = {}
    try:
        import numpy
        numpy_version = numpy.__version__
        numpy_status['up_to_date'] = parse_version(
            numpy_version) >= parse_version(numpy_min_version)
        numpy_status['version'] = numpy_version
    except ImportError:
        numpy_status['up_to_date'] = False
        numpy_status['version'] = ""
    return numpy_status
1373935
def version(self, calver: bool = False, pre_release: bool = False) -> str:
        
        # TODO: Optimize
        version = '{}.{}.{}'
        major, minor, patch = self.random.randints(3, 0, 10)

        if calver:
            if minor == 0:
                minor += 1

            if patch == 0:
                patch += 1
            major = self.random.randint(2016, 2018)
            return version.format(major, minor, patch)

        version = '{}.{}.{}'.format(major, minor, patch)

        if pre_release:
            suffixes = ('alpha', 'beta', 'rc')
            suffix = self.random.choice(suffixes)
            number = self.random.randint(1, 11)
            return '{}-{}.{}'.format(version, suffix, number)

        return version
58483
def check_version(server, version, filename, timeout=SHORT_TIMEOUT):
    """"""

    address = VERSION_ENDPOINT.format(server=server)

    print('Checking for software updates...')
    log.info('Existing OK version: %s', version)
    log.info('Checking latest version from %s', address)

    try:
        response = requests.get(address, timeout=timeout)
        response.raise_for_status()
    except (requests.exceptions.RequestException, requests.exceptions.BaseHTTPError) as e:
        print('Network error when checking for updates.')
        log.warning('Network error when checking version from %s: %s', address,
                    str(e), stack_info=True)
        return False

    response_json = response.json()
    if not _validate_api_response(response_json):
        print('Error while checking updates: malformed server response')
        log.info('Malformed response from %s: %s', address, response.text)
        return False

    current_version = response_json['data']['results'][0]['current_version']
    if current_version == version:
        print('OK is up to date')
        return True

    download_link = response_json['data']['results'][0]['download_link']

    log.info('Downloading version %s from %s', current_version, download_link)

    try:
        response = requests.get(download_link, timeout=timeout)
        response.raise_for_status()
    except (requests.exceptions.RequestException, requests.exceptions.BaseHTTPError) as e:
        print('Error when downloading new version of OK')
        log.warning('Error when downloading new version of OK: %s', str(e),
                    stack_info=True)
        return False

    log.info('Writing new version to %s', filename)

    zip_binary = response.content
    try:
        _write_zip(filename, zip_binary)
    except IOError as e:
        print('Error when downloading new version of OK')
        log.warning('Error writing to %s: %s', filename, str(e))
        return False
    else:
        print('Updated to version: {}'.format(current_version))
        log.info('Successfully wrote to %s', filename)
        return True
377412
def get_version():
    
    VERSION_FILE = os.path.join(module_name, 'version.py')
    txt = open(VERSION_FILE).read()
    mo = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', txt, re.M)
    if mo:
        version = mo.group(1)
        bs_version = os.environ.get('MODULEVER', '0.0')
        assert bs_version == "0.0" or bs_version == version, \
            "Version {} specified by the build system doesn't match {} in " \
            "version.py".format(bs_version, version)
        return version
    else:
        raise RuntimeError('Unable to find version string in {0}.'
                           .format(VERSION_FILE))
174700
def pypi_module_version_is_available(module, version):
    ""
    # returns True/False (or None if failed to execute the check)

    # using a hack that when passing "module==" w/ no version number to pip
    # it "fails" and returns all the available versions in stderr
    try:
        cmd = f"pip install {module}=="
        result = subprocess.run(cmd.split(), shell=False, check=False,
                                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    except Exception as e:
        print(f"Error: {e}")
        return None
    else:
        if result.returncode == 1 and result.stderr:
            output = result.stderr.decode('utf-8')
            return True if version in output else False
        else:
            print(f"Some error in {cmd}")
            return None
1135787
def check_if_release_is_current(log):
    """"""
    if __version__ == '0.0.0':
        return
    client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
    latest_pypi_version = client.package_releases('hca')

    latest_version_nums = [int(i) for i in latest_pypi_version[0].split('.')]
    this_version_nums = [int(i) for i in __version__.split('.')]
    for i in range(max([len(latest_version_nums), len(this_version_nums)])):
        try:
            if this_version_nums[i] < latest_version_nums[i]:
                log.warning('WARNING: Python (pip) package "hca" is not up-to-date!\n'
                            'You have hca version:              ' + str(__version__) + '\n'
                            'Please use the latest hca version: ' + str(latest_pypi_version[0]))
            # handles the odd case where a user's current __version__ is higher than PyPi's
            elif this_version_nums[i] > latest_version_nums[i]:
                break
        # if 4.2 compared to 4.3.1, this handles the missing element
        except IndexError:
            pass
1183116
def _validate_python_version(s):
    ""
    if not s:
        return True
    toks = s.split('.')
    if len(toks) != 2:
        return False
    try:
        int(toks[0])
        int(toks[1])
    except ValueError:
        return False
    return True
1216750
def all_versions_equal(self, versions):  # type: (Dict[str,str]) -> bool
        
        if len(versions) <= 1:
            return True

        semver = None
        for key, version in versions.items():
            if semver is None:
                try:
                    semver, _, __ = version_object_and_next(version)
                except ValueError:
                    logger.error("Invalid version at:" + unicode((key, version)))
                    return False
                continue
            try:
                version_as_version, _, __ = version_object_and_next(version)
            except:
                return False
            if version_as_version != semver:
                return False
        return True
219409
def checkVersion(self):
        """"""

        r = self.doQuery('version')

        if r.status_code == 200:  # Query ok ?
            data = r.json()

            if data['result'] == 'Ok' and data['version'] == self.PI_API_VERSION and data['protocol'] == self.PI_API_NAME:
                return True
        return False
985727
def get_version(self, is_full: bool = False) -> dict or str:
        
        payload = self.generate_json_rpc_payload(RpcMethod.GET_VERSION)
        response = self.__post(self.__url, payload)
        if is_full:
            return response
        return response['result']
204662
def _compute_version_info():
    
    ray_version = ray.__version__
    python_version = ".".join(map(str, sys.version_info[:3]))
    pyarrow_version = pyarrow.__version__
    return ray_version, python_version, pyarrow_version
845005
def get_version(module_name_or_file=None):
    """"""

    if module_name_or_file is None:
        parts = base_module.split('.')
        module_name_or_file = parts[0] if len(parts) > 1 else \
            find_packages(exclude=['test', 'test.*'])[0]

    if os.path.isdir(module_name_or_file):
        module_name_or_file = os.path.join(module_name_or_file, '__init__.py')

    with open(module_name_or_file, 'r') as f:
        match = VERSION_PATTERN.search(f.read())
        return match.group(1)
1185547
def outdated(self):
        
        if hydpy.pub.options.forcecompiling:
            return True
        if os.path.split(hydpy.__path__[0])[-2].endswith('-packages'):
            return False
        if not os.path.exists(self.dllfilepath):
            return True
        cydate = os.stat(self.dllfilepath).st_mtime
        for pysourcefile in self.pysourcefiles:
            pydate = os.stat(pysourcefile).st_mtime
            if pydate > cydate:
                return True
        return False
965945
def check_update_available(self):
        
        # Don't perform any check for development versions
        if 'dev' in self.version:
            return (False, latest_release)

        # Filter releases
        if is_stable_version(self.version):
            releases = [r for r in self.releases if is_stable_version(r)]
        else:
            releases = [r for r in self.releases
                        if not is_stable_version(r) or r in self.version]

        latest_release = releases[-1]

        return (check_version(self.version, latest_release, '<'),
                latest_release)
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'])
1343458
def version(self, pretty=False, best=False):
        
        versions = [
            self.os_release_attr('version_id'),
            self.lsb_release_attr('release'),
            self.distro_release_attr('version_id'),
            self._parse_distro_release_content(
                self.os_release_attr('pretty_name')).get('version_id', ''),
            self._parse_distro_release_content(
                self.lsb_release_attr('description')).get('version_id', ''),
            self.uname_attr('release')
        ]
        version = ''
        if best:
            # This algorithm uses the last version in priority order that has
            # the best precision. If the versions are not in conflict, that
            # does not matter; otherwise, using the last one instead of the
            # first one might be considered a surprise.
            for v in versions:
                if v.count(".") > version.count(".") or version == '':
                    version = v
        else:
            for v in versions:
                if v != '':
                    version = v
                    break
        if pretty and version and self.codename():
            version = u'{0} ({1})'.format(version, self.codename())
        return version
996493
def _get_version():
    """"""
    with open("../waliki/__init__.py") as fh:
        for line in fh:
            if line.startswith("__version__ = "):
                return line.split("=")[-1].strip().strip("'").strip('"')