当前位置: 首页>>代码示例>>Python>>正文


Python semantic_version.Version方法代码示例

本文整理汇总了Python中semantic_version.Version方法的典型用法代码示例。如果您正苦于以下问题:Python semantic_version.Version方法的具体用法?Python semantic_version.Version怎么用?Python semantic_version.Version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在semantic_version的用法示例。


在下文中一共展示了semantic_version.Version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _compare_build_json

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def _compare_build_json(self, contract_name: str) -> bool:
        config = self._compiler_config
        # confirm that this contract was previously compiled
        try:
            source = self._sources.get(contract_name)
            build_json = self._build.get(contract_name)
        except KeyError:
            return True
        # compare source hashes
        if build_json["sha1"] != sha1(source.encode()).hexdigest():
            return True
        # compare compiler settings
        if _compare_settings(config, build_json["compiler"]):
            return True
        if build_json["language"] == "Solidity":
            # compare solc-specific compiler settings
            solc_config = config["solc"].copy()
            solc_config["remappings"] = None
            if _compare_settings(solc_config, build_json["compiler"]):
                return True
            # compare solc pragma against compiled version
            if Version(build_json["compiler"]["version"]) not in get_pragma_spec(source):
                return True
        return False 
开发者ID:eth-brownie,项目名称:brownie,代码行数:26,代码来源:main.py

示例2: test_process_version_from_title

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def test_process_version_from_title():
    """Test converting title into version as per SemVer versioning"""
    latest_version = Version("0.0.1")

    title = '3.7.8 release'
    match, version = process_version_from_title(title, latest_version)
    assert version == "3.7.8"
    assert match is True
    title = 'new major release'
    match, version = process_version_from_title(title, latest_version)
    assert version == "1.0.0"
    assert match is True
    title = 'new minor release'
    match, version = process_version_from_title(title, latest_version)
    assert version == "0.1.0"
    assert match is True
    title = 'new patch release'
    match, version = process_version_from_title(title, latest_version)
    assert version == "0.0.2"
    assert match is True
    title = 'random release'
    match, version = process_version_from_title(title, latest_version)
    assert version == ""
    assert match is False 
开发者ID:user-cont,项目名称:release-bot,代码行数:26,代码来源:test_utils.py

示例3: resolve_custom_platform_version

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def resolve_custom_platform_version(
        custom_platforms,
        selected_platform_name
):
    version_to_arn_mappings = generate_version_to_arn_mappings(
        custom_platforms,
        selected_platform_name
    )

    custom_platform_versions = []
    for custom_platform_version in version_to_arn_mappings.keys():
        custom_platform_versions.append(Version(custom_platform_version))

    if len(custom_platform_versions) > 1:
        chosen_custom_platform_arn = prompt_customer_for_custom_platform_version(
            version_to_arn_mappings
        )
    else:
        chosen_custom_platform_arn = custom_platforms[0]

    return PlatformVersion(chosen_custom_platform_arn) 
开发者ID:QData,项目名称:deepWordBug,代码行数:23,代码来源:platformops.py

示例4: register

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def register(cfg, location, kernel):
    first_run(cfg)
    kernel_version = kernel
    if kernel_version == 'latest':
        templates = local.get_local_templates(pros_cfg=cfg.pros_cfg,
                                              template_types=[TemplateTypes.kernel])  # type: List[Identifier]
        if not templates or len(templates) == 0:
            click.echo('No templates have been downloaded! Use `pros conduct download` to download the latest kernel or'
                       ' specify a kernel manually.')
            click.get_current_context().abort()
            sys.exit()
        kernel_version = sorted(templates, key=lambda t: semver.Version(t.version))[-1].version
        proscli.utils.debug('Resolved version {} to {}'.format(kernel, kernel_version))

    cfg = prosconfig.ProjectConfig(location, create=True, raise_on_error=True)
    cfg.kernel = kernel_version
    if not location:
        click.echo('Location not specified, registering current directory.')
    click.echo('Registering {} with kernel {}'.format(location or os.path.abspath('.'), kernel_version))
    cfg.save()


# endregion 
开发者ID:purduesigbots,项目名称:pros-cli2,代码行数:25,代码来源:conductor.py

示例5: is_compatible

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def is_compatible(self, platform_version, inclusive=False):
        """Checks if a release is compatible with a platform version

        :param platform_version: the platform version, not required to be
                                 semver compatible
        :param inclusive: if True the check will also return True if an app
                          requires 9.0.1 and the given platform version is 9.0
        :return: True if compatible, otherwise false
        """

        min_version = Version(pad_min_version(platform_version))
        spec = Spec(self.platform_version_spec)
        if inclusive:
            max_version = Version(pad_max_inc_version(platform_version))
            return (min_version in spec or max_version in spec)
        else:
            return min_version in spec 
开发者ID:nextcloud,项目名称:appstore,代码行数:19,代码来源:models.py

示例6: set_solc_version_pragma

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def set_solc_version_pragma(pragma_string, silent=False, check_new=False):
    version = _select_pragma_version(
        pragma_string, [Version(i[1:]) for i in get_installed_solc_versions()]
    )
    if not version:
        raise SolcNotInstalled(
            "No compatible solc version installed. "
            + "Use solcx.install_solc_version_pragma('{}') to install.".format(version)
        )
    version = _check_version(version)
    global solc_version
    solc_version = version
    if not silent:
        LOGGER.info("Using solc version {}".format(solc_version))
    if check_new:
        latest = install_solc_pragma(pragma_string, False)
        if Version(latest) > Version(version[1:]):
            LOGGER.info("Newer compatible solc version exists: {}".format(latest)) 
开发者ID:iamdefinitelyahuman,项目名称:py-solc-x,代码行数:20,代码来源:install.py

示例7: test_get_solc_version

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def test_get_solc_version():
    version = get_solc_version()

    assert isinstance(version, semantic_version.Version) 
开发者ID:ethereum,项目名称:py-solc,代码行数:6,代码来源:test_solc_version.py

示例8: get_solc_version_string

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def get_solc_version_string(**kwargs):
    kwargs['version'] = True
    stdoutdata, stderrdata, command, proc = solc_wrapper(**kwargs)
    _, _, version_string = stdoutdata.partition('\n')
    if not version_string or not version_string.startswith('Version: '):
        raise SolcError(
            command=command,
            return_code=proc.returncode,
            stdin_data=None,
            stdout_data=stdoutdata,
            stderr_data=stderrdata,
            message="Unable to extract version string from command output",
        )
    return version_string 
开发者ID:ethereum,项目名称:py-solc,代码行数:16,代码来源:main.py

示例9: get_solc_version

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def get_solc_version(**kwargs):
    # semantic_version as of 2017-5-5 expects only one + to be used in string
    return semantic_version.Version(
        strip_zeroes_from_month_and_day(
            get_solc_version_string(**kwargs)
            [len('Version: '):]
            .replace('++', 'pp'))) 
开发者ID:ethereum,项目名称:py-solc,代码行数:9,代码来源:main.py

示例10: test_set_solc_version

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def test_set_solc_version():
    compiler.set_solc_version("0.5.7")
    assert solcx.get_solc_version().truncate() == compiler.solidity.get_version()
    assert solcx.get_solc_version().truncate() == Version("0.5.7")
    compiler.set_solc_version("0.4.25")
    assert solcx.get_solc_version().truncate() == compiler.solidity.get_version()
    assert solcx.get_solc_version().truncate() == Version("0.4.25") 
开发者ID:eth-brownie,项目名称:brownie,代码行数:9,代码来源:test_solidity.py

示例11: test_generate_input_json_evm

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def test_generate_input_json_evm(solc5source, monkeypatch):
    monkeypatch.setattr("solcx.get_solc_version", lambda: Version("0.5.5"))
    fn = functools.partial(compiler.generate_input_json, {"path.sol": solc5source})
    assert fn()["settings"]["evmVersion"] == "petersburg"
    assert fn(evm_version="byzantium")["settings"]["evmVersion"] == "byzantium"
    assert fn(evm_version="petersburg")["settings"]["evmVersion"] == "petersburg"
    monkeypatch.setattr("solcx.get_solc_version", lambda: Version("0.5.4"))
    assert fn()["settings"]["evmVersion"] == "byzantium"
    assert fn(evm_version="byzantium")["settings"]["evmVersion"] == "byzantium"
    assert fn(evm_version="petersburg")["settings"]["evmVersion"] == "petersburg" 
开发者ID:eth-brownie,项目名称:brownie,代码行数:12,代码来源:test_solidity.py

示例12: get_version

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def get_version() -> Version:
    return solcx.get_solc_version().truncate() 
开发者ID:eth-brownie,项目名称:brownie,代码行数:4,代码来源:solidity.py

示例13: compile_from_input_json

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def compile_from_input_json(
    input_json: Dict, silent: bool = True, allow_paths: Optional[str] = None
) -> Dict:

    """
    Compiles contracts from a standard input json.

    Args:
        input_json: solc input json
        silent: verbose reporting
        allow_paths: compiler allowed filesystem import path

    Returns: standard compiler output json
    """

    optimizer = input_json["settings"]["optimizer"]
    input_json["settings"].setdefault("evmVersion", None)
    if input_json["settings"]["evmVersion"] in EVM_EQUIVALENTS:
        input_json["settings"]["evmVersion"] = EVM_EQUIVALENTS[input_json["settings"]["evmVersion"]]

    if not silent:
        print(f"Compiling contracts...\n  Solc version: {str(solcx.get_solc_version())}")

        opt = f"Enabled  Runs: {optimizer['runs']}" if optimizer["enabled"] else "Disabled"
        print(f"  Optimizer: {opt}")

        if input_json["settings"]["evmVersion"]:
            print(f"  EVM Version: {input_json['settings']['evmVersion'].capitalize()}")

    try:
        return solcx.compile_standard(
            input_json,
            optimize=optimizer["enabled"],
            optimize_runs=optimizer["runs"],
            evm_version=input_json["settings"]["evmVersion"],
            allow_paths=allow_paths,
        )
    except solcx.exceptions.SolcError as e:
        raise CompilerError(e) 
开发者ID:eth-brownie,项目名称:brownie,代码行数:41,代码来源:solidity.py

示例14: _get_solc_version_list

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def _get_solc_version_list() -> Tuple[List, List]:
    global AVAILABLE_SOLC_VERSIONS
    installed_versions = [Version(i[1:]) for i in solcx.get_installed_solc_versions()]
    if AVAILABLE_SOLC_VERSIONS is None:
        try:
            AVAILABLE_SOLC_VERSIONS = [Version(i[1:]) for i in solcx.get_available_solc_versions()]
        except ConnectionError:
            if not installed_versions:
                raise ConnectionError("Solc not installed and cannot connect to GitHub")
            AVAILABLE_SOLC_VERSIONS = installed_versions
    return AVAILABLE_SOLC_VERSIONS, installed_versions 
开发者ID:eth-brownie,项目名称:brownie,代码行数:13,代码来源:solidity.py

示例15: installed_version

# 需要导入模块: import semantic_version [as 别名]
# 或者: from semantic_version import Version [as 别名]
def installed_version(self, name, version):
        if name in self.packages:
            pkg_version = self.get_package_version(name)
            pkg_version = self._convert_old_version(pkg_version)
            version = self._convert_old_version(version)
            return (semantic_version.Version(pkg_version) ==
                    semantic_version.Version(version)) 
开发者ID:FPGAwars,项目名称:apio,代码行数:9,代码来源:profile.py


注:本文中的semantic_version.Version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。