class Dependabot::Uv::Requirement

def convert_wildcard(req_string)

def convert_wildcard(req_string)
  # NOTE: This isn't perfect. It replaces the "!= 1.0.*" case with
  # "!= 1.0.0". There's no way to model this correctly in Ruby :'(
  quoted_ops = OPS.keys.sort_by(&:length).reverse
                  .map { |k| Regexp.quote(k) }.join("|")
  op = req_string.match(/\A\s*(#{quoted_ops})?/)
                 .captures.first.to_s&.strip
  exact_op = ["", "=", "==", "==="].include?(op)
  req_string.strip
            .split(".")
            .first(req_string.split(".").index { |s| s.include?("*") } + 1)
            .join(".")
            .gsub(/\*(?!$)/, "0")
            .gsub(/\*$/, "0.dev")
            .tap { |s| exact_op ? s.gsub!(/^(?<!!)=*/, "~>") : s }
end