diff --git a/core/dbt/deps/registry.py b/core/dbt/deps/registry.py index 38afdcaf330..a1b31e3b520 100644 --- a/core/dbt/deps/registry.py +++ b/core/dbt/deps/registry.py @@ -88,10 +88,7 @@ def download_and_untar(self, download_url, tar_path, deps_path, package_name): class RegistryUnpinnedPackage(RegistryPackageMixin, UnpinnedPackage[RegistryPinnedPackage]): def __init__( - self, - package: str, - versions: List[semver.VersionSpecifier], - install_prerelease: bool + self, package: str, versions: List[semver.VersionSpecifier], install_prerelease: bool ) -> None: super().__init__(package) self.versions = versions @@ -110,7 +107,7 @@ def from_contract(cls, contract: RegistryPackage) -> "RegistryUnpinnedPackage": return cls( package=contract.package, versions=versions, - install_prerelease=contract.install_prerelease + install_prerelease=contract.install_prerelease, ) def incorporate(self, other: "RegistryUnpinnedPackage") -> "RegistryUnpinnedPackage": diff --git a/core/dbt/semver.py b/core/dbt/semver.py index 6d8c98872f2..ea864a61737 100644 --- a/core/dbt/semver.py +++ b/core/dbt/semver.py @@ -125,9 +125,9 @@ def compare(self, other): if self.is_unbounded or other.is_unbounded: return 0 - for key in ['major', 'minor', 'patch', 'prerelease']: + for key in ["major", "minor", "patch", "prerelease"]: (a, b) = (getattr(self, key), getattr(other, key)) - if key == 'prerelease': + if key == "prerelease": if a is None and b is None: continue if a is None: @@ -424,7 +424,7 @@ def resolve_to_specific_version(requested_range, available_versions): version = VersionSpecifier.from_version_string(version_string) if versions_compatible(version, requested_range.start, requested_range.end) and ( - requested_range.start, requested_range.end) and + max_version is None or max_version.compare(version) < 0 ): max_version = version max_version_string = version_string @@ -432,10 +432,7 @@ def resolve_to_specific_version(requested_range, available_versions): return max_version_string -def filter_installable( - versions: List[str], - install_prerelease: bool -) -> List[str]: +def filter_installable(versions: List[str], install_prerelease: bool) -> List[str]: installable = [] installable_dict = {} for version_string in versions: