class Dependabot::Uv::FileUpdater::LockFileUpdater

def updated_lockfile_content

def updated_lockfile_content
  @updated_lockfile_content ||=
    begin
      original_content = T.must(lockfile).content
      # Extract the original requires-python value to preserve it
      original_requires_python = T.must(original_content)
                                  .match(/requires-python\s*=\s*["']([^"']+)["']/)&.captures&.first
      # Store the original Python version requirement for later use
      @original_python_version = T.let(original_requires_python, T.nilable(String))
      new_lockfile = updated_lockfile_content_for(prepared_pyproject)
      # Normalize line endings to ensure proper comparison
      new_lockfile = normalize_line_endings(new_lockfile, T.must(original_content))
      result = new_lockfile
      # Restore the original requires-python if it exists
      if original_requires_python
        result = result.gsub(/requires-python\s*=\s*["'][^"']+["']/,
                             "requires-python = \"#{original_requires_python}\"")
      end
      result
    end
end