class Dependabot::Uv::LanguageVersionManager

def python_version_from_supported_versions

def python_version_from_supported_versions
  requirement_string = python_requirement_string
  # If the requirement string isn't already a range (eg ">3.10"), coerce it to "major.minor.*".
  # The patch version is ignored because a non-matching patch version is unlikely to affect resolution.
  requirement_string = requirement_string.gsub(/\.\d+$/, ".*") if /^\d/.match?(requirement_string)
  requirement_string = normalize_python_exact_version(requirement_string)
  if requirement_string.nil? || requirement_string.strip.empty?
    return Language::PRE_INSTALLED_HIGHEST_VERSION.to_s
  end
  # Try to match one of our pre-installed Python versions
  requirement = T.must(Requirement.requirements_array(requirement_string).first)
  version = Language::PRE_INSTALLED_PYTHON_VERSIONS.find { |v| requirement.satisfied_by?(v) }
  return version.to_s if version
  # Otherwise we have to raise an error
  supported_versions = Language::SUPPORTED_VERSIONS.map { |v| "#{v}.*" }.join(", ")
  raise ToolVersionNotSupported.new("Python", python_requirement_string, supported_versions)
end