Backwards-compatibility for 0.14 and later
505244
def getinfo(self):
        
        try:
            old_getinfo = AuthServiceProxy(self.__service_url, 'getinfo', self.__timeout, self.__conn, True)
            res = old_getinfo()
            if 'error' not in res:
                # 0.13 and earlier
                return res

        except JSONRPCException:
            pass

        network_info = self.getnetworkinfo()
        blockchain_info = self.getblockchaininfo()
        try:
            wallet_info = self.getwalletinfo()
        except:
            wallet_info = {
                'walletversion': None,
                'balance': None,
                'keypoololdest': None,
                'keypoolsize': None,
                'paytxfee': None,
            }

        res = {
            'version': network_info['version'],
            'protocolversion': network_info['protocolversion'],
            'walletversion': wallet_info['walletversion'],
            'balance': wallet_info['balance'],
            'blocks': blockchain_info['blocks'],
            'timeoffset': network_info['timeoffset'],
            'connections': network_info['connections'],
            'proxy': network_info['networks'],
            'difficulty': blockchain_info['difficulty'],
            'testnet': blockchain_info['chain'] == 'testnet',
            'keypoololdest': wallet_info['keypoololdest'],
            'keypoolsize': wallet_info['keypoolsize'],
            'paytxfee': wallet_info['paytxfee'],
            'errors': network_info['warnings'],
        }
        
        for k in ['unlocked_until', 'relayfee', 'paytxfee']:
            if wallet_info.has_key(k):
                res[k] = wallet_info[k]

        return res
43348
private void updateNPMExecutable(NodeInstallationInformation information) throws MojoExecutionException {
    getLog().info("Installing specified npm version " + npmVersion);
    NpmInstallTask npmInstallTask = new NpmInstallTask();
    npmInstallTask.setLog(getLog());
    npmInstallTask.setNpmBundledWithNodeJs(true);
    npmInstallTask.setArguments(new String[] {
        "--prefix", information.getNodeModulesRootPath(), "--global", "npm@" + npmVersion
    });
    npmInstallTask.execute(information);
  }
1360628
def _version_checker(module, minver):
    
    # We could use LooseVersion, but distutils imports imp which is deprecated
    version_regexp = r'[a-z]?((?:\d|\.)+\d+)(?:\.dev[0-9]+)?'
    version_tags = re.match(version_regexp, module.__version__)
    if not version_tags:
        return False
    version_tags = version_tags.group(1).split(".")
    version_tags = tuple(int(x) for x in version_tags)
    return version_tags >= minver
213587
function cmpVersion(a, b) {
    "use strict";
    var i, cmp, len, re = /(\.0)+[^\.]*$/;
    function versionToString(version) {
        if (isObject(version)) {
            try {
                return [version.major, version.minor, version.patch].join('.');
            } catch (e) {}
        }
        return version;
    }
    a = versionToString(a);
    b = versionToString(b);
    a = (a + '').replace(re, '').split('.');
    b = (b + '').replace(re, '').split('.');
    len = Math.min(a.length, b.length);
    for (i = 0; i < len; i++) {
        cmp = parseInt(a[i], 10) - parseInt(b[i], 10);
        if (cmp !== 0) {
            return cmp;
        }
    }
    return a.length - b.length;
}
350539
function listWithoutVersions() {
  const options = {
    transforms() {
      return [filter({wantStrings: true}, function (str) {
        return str.indexOf('@') === -1;
      })];
    }
  };

  return list(options);
}
1264593
def sync(
    ctx,
    state,
    bare=False,
    user=False,
    unused=False,
    **kwargs
):
    """"""
    from ..core import do_sync

    retcode = do_sync(
        ctx=ctx,
        dev=state.installstate.dev,
        three=state.three,
        python=state.python,
        bare=bare,
        dont_upgrade=(not state.installstate.keep_outdated),
        user=user,
        clear=state.clear,
        unused=unused,
        sequential=state.installstate.sequential,
        pypi_mirror=state.pypi_mirror,
    )
    if retcode:
        ctx.abort()
951567
def unpack_version(version):
    """"""
    minor_version = version % VERSION_MULTIPLIER
    major_version = (version - minor_version) / VERSION_MULTIPLIER
    return (major_version, minor_version)
323621
function restorePackState(gl, options) {
  if (options.colorspaceConversion !== undefined) {
    gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, lastPackState.colorspaceConversion);
  }
  if (options.premultiplyAlpha !== undefined) {
    gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, lastPackState.premultiplyAlpha);
  }
  if (options.flipY !== undefined) {
    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, lastPackState.flipY);
  }
}
547360
def _link_package_versions(self, link, search, ignore_compatibility=True):
        # type: (Link, Search, bool) -> Optional[InstallationCandidate]
        """"""
        version = None
        if link.egg_fragment:
            egg_info = link.egg_fragment
            ext = link.ext
        else:
            egg_info, ext = link.splitext()
            if not ext:
                self._log_skipped_link(link, 'not a file')
                return None
            if ext not in SUPPORTED_EXTENSIONS:
                self._log_skipped_link(
                    link, 'unsupported archive format: %s' % ext,
                )
                return None
            if "binary" not in search.formats and ext == WHEEL_EXTENSION and not ignore_compatibility:
                self._log_skipped_link(
                    link, 'No binaries permitted for %s' % search.supplied,
                )
                return None
            if "macosx10" in link.path and ext == '.zip' and not ignore_compatibility:
                self._log_skipped_link(link, 'macosx10 one')
                return None
            if ext == WHEEL_EXTENSION:
                try:
                    wheel = Wheel(link.filename)
                except InvalidWheelFilename:
                    self._log_skipped_link(link, 'invalid wheel filename')
                    return None
                if canonicalize_name(wheel.name) != search.canonical:
                    self._log_skipped_link(
                        link, 'wrong project name (not %s)' % search.supplied)
                    return None

                if not wheel.supported(self.valid_tags) and not ignore_compatibility:
                    self._log_skipped_link(
                        link, 'it is not compatible with this Python')
                    return None

                version = wheel.version

        # This should be up by the search.ok_binary check, but see issue 2700.
        if "source" not in search.formats and ext != WHEEL_EXTENSION:
            self._log_skipped_link(
                link, 'No sources permitted for %s' % search.supplied,
            )
            return None

        if not version:
            version = _egg_info_matches(egg_info, search.canonical)
        if not version:
            self._log_skipped_link(
                link, 'Missing project version for %s' % search.supplied)
            return None

        match = self._py_version_re.search(version)
        if match:
            version = version[:match.start()]
            py_version = match.group(1)
            if py_version != sys.version[:3]:
                self._log_skipped_link(
                    link, 'Python version is incorrect')
                return None
        try:
            support_this_python = check_requires_python(link.requires_python)
        except specifiers.InvalidSpecifier:
            logger.debug("Package %s has an invalid Requires-Python entry: %s",
                         link.filename, link.requires_python)
            support_this_python = True

        if not support_this_python and not ignore_compatibility:
            logger.debug("The package %s is incompatible with the python "
                         "version in use. Acceptable python versions are: %s",
                         link, link.requires_python)
            return None
        logger.debug('Found link %s, version: %s', link, version)

        return InstallationCandidate(search.supplied, version, link, link.requires_python)
1193756
public function Upgrade171to172()
    {
        $this->_batch->addTask('Db_CreateNewTables');
        $this->_batch->addTask('Db_AddPatches', 58);

        $this->_batch->addTask('Echo', $this->_('Make sure to read the changelog as it contains important instructions'));
        $this->_batch->addTask('Echo', $this->_('Check the Code compatibility report for any issues with project specific code!'));

        return true;
    }
43257
function () {
        /* BACKWARD-COMPATIBILITY-BEGIN (GitHub #1397) */
        /**
         * <b>Deprecated, use aria.core.Browser.ua instead.</b>
         *
         * <p>
         * The user agent string.
         * </p>
         *
         * @type String
         * @deprecated use aria.core.Browser.ua instead
         */
        this.ua = null;
         */

        /**
         * Previous orientation value to check if event should be raised (value changed or not).
         * @type Boolean
         * @private
         */
        this._previousIsPortrait = this.isPortrait(true);

        /* BACKWARD-COMPATIBILITY-BEGIN (GitHub #1397) */
        this._deprecatedProperties = []; // for init to process well
         */

        /* BACKWARD-COMPATIBILITY-BEGIN (GitHub #1397) */
        var properties = [
            {
                name: "ua",
                alternative: "aria.core.Browser.ua"
            },

            {
                name: "isMobile",
                type: "method",
                underlying: "isPhone"
            },
            {
                name: "isPhoneGap",
                type: "method",
                underlying: {
                    name: "isPhoneGap",
                    container: ariaCoreBrowser,
                    containerName: "aria.core.Browser"
                }
            },
            {
                name: "is2DTransformCapable",
                type: "method",
                underlying: {
                    name: "is2DTransformCapable",
                    container: ariaCoreBrowser,
                    containerName: "aria.core.Browser"
                }
            },
            {
                name: "is3DTransformCapable",
                type: "method",
                underlying: {
                    name: "is3DTransformCapable",
                    container: ariaCoreBrowser,
                    containerName: "aria.core.Browser"
                }
            }
        ];

        var deprecatedProperties = [];
        var isString = ariaUtilsType.isString;
        ariaUtilsArray.forEach(properties, function(property) {
            // ------------------------------------------------ property factory

            if (ariaUtilsType.isString(property)) {
                property = {name: property};
            }

            // ------------------------------------------------------------ name

            var name = property.name;

            // ------------------------------------------------------------ type

            var type = property.type;

            if (type == null) {
                type = "attribute";
            }

            property.type = type;

            // ----------------------------------------------- underlying method

            var possibleAlternative;

            if (type == "method") {
                var underlying = property.underlying;

                if (isString(underlying)) {
                    underlying = {name: underlying};
                }

                var underlyingName = underlying.name;

                var underlyingContainer = underlying.container;
                if (underlyingContainer == null) {
                    underlyingContainer = this;
                }
                underlying.container = underlyingContainer;

                var underlyingContainerName = underlying.containerName;

                // -------------------------------------------------------------

                possibleAlternative = "";
                if (underlyingContainerName != null) {
                    possibleAlternative += underlyingContainerName + ".";
                }
                possibleAlternative += underlyingName;

                underlying = function() {
                    return underlyingContainer[underlyingName].apply(underlyingContainer, arguments);
                };

                property.underlying = underlying;
            }

            // ----------------------------------------------------- alternative

            var alternative = property.alternative;

            if (alternative == null && possibleAlternative != null) {
                alternative = possibleAlternative;
            }

            property.alternative = alternative;

            // --------------------------------------------------- extrapolation

            var loggingMessage;
            var loggingMessageArguments = [name];

            if (alternative != null) {
                loggingMessage = type == "attribute" ? "DEPRECATED_REPLACED_PROPERTY" : "DEPRECATED_REPLACED_METHOD";
                loggingMessageArguments.push(alternative);
            } else {
                loggingMessage = type == "attribute" ? "DEPRECATED_REMOVED_PROPERTY" : "DEPRECATED_REMOVED_METHOD";
            }

            property.loggingMessage = this[loggingMessage];
            property.loggingMessageArguments = loggingMessageArguments;

            // ---------------------------------------------------------- result

            deprecatedProperties.push(property);
        }, this);

        this._deprecatedProperties = deprecatedProperties;
        this.__deprecateProperties();
         */

        this.init();
    }
772349
function compareVersions(fstVer, sndVer) {
    if (semver.lt(fstVer, sndVer)) {
        return 1;
    }
    if (semver.gt(fstVer, sndVer)) {
        return -1;
    }
    return 0;
}
1330713
async function nextVersion (bumpType, version) {
  if (utils.isNightly(version) || utils.isBeta(version)) {
    switch (bumpType) {
      case 'nightly':
        version = await utils.nextNightly(version)
        break
      case 'beta':
        version = await utils.nextBeta(version)
        break
      case 'stable':
        version = semver.valid(semver.coerce(version))
        break
      default:
        throw new Error('Invalid bump type.')
    }
  } else if (utils.isStable(version)) {
    switch (bumpType) {
      case 'nightly':
        version = utils.nextNightly(version)
        break
      case 'beta':
        throw new Error('Cannot bump to beta from stable.')
      case 'stable':
        version = semver.inc(version, 'patch')
        break
      default:
        throw new Error('Invalid bump type.')
    }
  } else {
    throw new Error(`Invalid current version: ${version}`)
  }
  return version
}
19281
def require_compatible_version(compatible_version, word="File"):
    """"""
    if isinstance(compatible_version, str):
        compatible_version = parse_version(compatible_version)
    elif not isinstance(compatible_version, Version):
        raise ValueError("Type of `compatible_version` not understood.")
    
    current_version = parse_version(CURRENT_VERSION)
    if current_version < compatible_version:
        raise VersionError("{0} written for version >= {1}, this is {2}.".format(
            word, str(compatible_version), CURRENT_VERSION
        ))
14110
def update(
    ctx,
    state,
    bare=False,
    dry_run=None,
    outdated=False,
    **kwargs
):
    """"""
    from ..core import (
        ensure_project,
        do_outdated,
        do_lock,
        do_sync,
        project,
    )

    ensure_project(three=state.three, python=state.python, warn=True, pypi_mirror=state.pypi_mirror)
    if not outdated:
        outdated = bool(dry_run)
    if outdated:
        do_outdated(pypi_mirror=state.pypi_mirror)
    packages = [p for p in state.installstate.packages if p]
    editable = [p for p in state.installstate.editables if p]
    if not packages:
        echo(
            "{0} {1} {2} {3}{4}".format(
                crayons.white("Running", bold=True),
                crayons.red("$ pipenv lock", bold=True),
                crayons.white("then", bold=True),
                crayons.red("$ pipenv sync", bold=True),
                crayons.white(".", bold=True),
            )
        )
    else:
        for package in packages + editable:
            if package not in project.all_packages:
                echo(
                    "{0}: {1} was not found in your Pipfile! Aborting."
                    "".format(
                        crayons.red("Warning", bold=True),
                        crayons.green(package, bold=True),
                    ),
                    err=True,
                )
                ctx.abort()

    do_lock(
        clear=state.clear,
        pre=state.installstate.pre,
        keep_outdated=state.installstate.keep_outdated,
        pypi_mirror=state.pypi_mirror,
    )
    do_sync(
        ctx=ctx,
        dev=state.installstate.dev,
        three=state.three,
        python=state.python,
        bare=bare,
        dont_upgrade=not state.installstate.keep_outdated,
        user=False,
        clear=state.clear,
        unused=False,
        sequential=state.installstate.sequential,
        pypi_mirror=state.pypi_mirror,
    )
1095705
function replacePropagatingVersions(uri, data) {
  if (references.isPropagatingVersion(uri)) {
    references.replaceAllVersions(uri.split('@')[1])(data);
  }

  return data;
}
1310271
function convertForPackage(context, pkg) {
	var name = pkg.name;
	var version = pkg.version;

	var conv = context.deferredConversions;
	var pkgConv = conv[name];
	var depPkg, fns, keys = 0;
	if(pkgConv) {
		for(var range in pkgConv) {
			depPkg = crawl.matchedVersion(context, name, range);
			if(depPkg) {
				fns = pkgConv[range];
				for(var i = 0, len = fns.length; i < len; i++) {
					fns[i].call(context);
				}
				delete pkgConv[range];
			} else {
				keys++;
			}
		}
		if(keys === 0) {
			delete conv[name];
		}
	}
}