prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  archinstall won't start due to TypeError
  # Error
  When I execute `archinstall` I get the following error:
  
  ```
  ...
  File "/usr/lib/python3.10/site-packages/archinstall/lib/packages/packages.py", line 115, in installed_package
    return LocalPackage(**package_info)
  TypeError: LocalPackage.__init__() got an unexpected keyword argument 'warning'
  ```
  # What I tried
  I looked at the code of `installed_package` and found it executes `pacman -Q --info {package}`, so I tried to execute that with archlinux-keyring to see what the output was like.
  
  I executed `pacman -Q --info archlinux-keyring` and got the following output
  ```
  warning: config file /etc/pacman.conf, line 19: directive 'SyncFirst' in section 'options' not recognized
  Name 	: archlinux-keyring
  Version : 20230225-1
  ...
  ```
  # Why this seems to be happening
  ## Code
  https://github.com/archlinux/archinstall/blob/8f6cc07062968b259bebd346521ef685c16f89dc/archinstall/lib/packages/packages.py#L105-L115
  ## Explanation 
  Because the line `warning: config file /etc/pacman.conf, line 19: directive 'SyncFirst' in section 'options' not recognized` I get as part of the output of `pacman -Q --info {package}` has a colon it is being interpreted as a key value pair.
  
  # Possible fix
  Ignore all lines that start with 'warning'
  
  
  
  </issue>
  <code>
  [start of archinstall/lib/packages/packages.py]
  1 import json
  2 import ssl
  3 from typing import Dict, Any, Tuple, List
  4 from urllib.error import HTTPError
  5 from urllib.parse import urlencode
  6 from urllib.request import urlopen
  7 
  8 from ..exceptions import PackageError, SysCallError
  9 from ..models.dataclasses import PackageSearch, PackageSearchResult, LocalPackage
  10 from ..pacman import run_pacman
  11 
  12 BASE_URL_PKG_SEARCH = 'https://archlinux.org/packages/search/json/'
  13 # BASE_URL_PKG_CONTENT = 'https://archlinux.org/packages/search/json/'
  14 BASE_GROUP_URL = 'https://archlinux.org/groups/search/json/'
  15 
  16 
  17 def _make_request(url: str, params: Dict) -> Any:
  18 	ssl_context = ssl.create_default_context()
  19 	ssl_context.check_hostname = False
  20 	ssl_context.verify_mode = ssl.CERT_NONE
  21 
  22 	encoded = urlencode(params)
  23 	full_url = f'{url}?{encoded}'
  24 
  25 	return urlopen(full_url, context=ssl_context)
  26 
  27 
  28 def group_search(name :str) -> List[PackageSearchResult]:
  29 	# TODO UPSTREAM: Implement /json/ for the groups search
  30 	try:
  31 		response = _make_request(BASE_GROUP_URL, {'name': name})
  32 	except HTTPError as err:
  33 		if err.code == 404:
  34 			return []
  35 		else:
  36 			raise err
  37 
  38 	# Just to be sure some code didn't slip through the exception
  39 	data = response.read().decode('UTF-8')
  40 
  41 	return [PackageSearchResult(**package) for package in json.loads(data)['results']]
  42 
  43 
  44 def package_search(package :str) -> PackageSearch:
  45 	"""
  46 	Finds a specific package via the package database.
  47 	It makes a simple web-request, which might be a bit slow.
  48 	"""
  49 	# TODO UPSTREAM: Implement bulk search, either support name=X&name=Y or split on space (%20 or ' ')
  50 	# TODO: utilize pacman cache first, upstream second.
  51 	response = _make_request(BASE_URL_PKG_SEARCH, {'name': package})
  52 
  53 	if response.code != 200:
  54 		raise PackageError(f"Could not locate package: [{response.code}] {response}")
  55 
  56 	data = response.read().decode('UTF-8')
  57 
  58 	return PackageSearch(**json.loads(data))
  59 
  60 
  61 def find_package(package :str) -> List[PackageSearchResult]:
  62 	data = package_search(package)
  63 	results = []
  64 
  65 	for result in data.results:
  66 		if result.pkgname == package:
  67 			results.append(result)
  68 
  69 	# If we didn't find the package in the search results,
  70 	# odds are it's a group package
  71 	if not results:
  72 		# Check if the package is actually a group
  73 		for result in group_search(package):
  74 			results.append(result)
  75 
  76 	return results
  77 
  78 
  79 def find_packages(*names :str) -> Dict[str, Any]:
  80 	"""
  81 	This function returns the search results for many packages.
  82 	The function itself is rather slow, so consider not sending to
  83 	many packages to the search query.
  84 	"""
  85 	result = {}
  86 	for package in names:
  87 		for found_package in find_package(package):
  88 			result[package] = found_package
  89 
  90 	return result
  91 
  92 
  93 def validate_package_list(packages :list) -> Tuple[list, list]:
  94 	"""
  95 	Validates a list of given packages.
  96 	return: Tuple of lists containing valid packavges in the first and invalid
  97 	packages in the second entry
  98 	"""
  99 	valid_packages = {package for package in packages if find_package(package)}
  100 	invalid_packages = set(packages) - valid_packages
  101 
  102 	return list(valid_packages), list(invalid_packages)
  103 
  104 
  105 def installed_package(package :str) -> LocalPackage:
  106 	package_info = {}
  107 	try:
  108 		for line in run_pacman(f"-Q --info {package}"):
  109 			if b':' in line:
  110 				key, value = line.decode().split(':', 1)
  111 				package_info[key.strip().lower().replace(' ', '_')] = value.strip()
  112 	except SysCallError:
  113 		pass
  114 
  115 	return LocalPackage(**package_info)
  116
  [end of archinstall/lib/packages/packages.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/archinstall/lib/packages/packages.py b/archinstall/lib/packages/packages.py
  --- a/archinstall/lib/packages/packages.py
  +++ b/archinstall/lib/packages/packages.py
  @@ -1,3 +1,4 @@
  +import dataclasses
   import json
   import ssl
   from typing import Dict, Any, Tuple, List
  @@ -112,4 +113,4 @@
   	except SysCallError:
   		pass
   
  -	return LocalPackage(**package_info)
  +	return LocalPackage({field.name: package_info.get(field.name) for field in dataclasses.fields(LocalPackage)})
  
verification_info: {"golden_diff": "diff --git a/archinstall/lib/packages/packages.py b/archinstall/lib/packages/packages.py\n--- a/archinstall/lib/packages/packages.py\n+++ b/archinstall/lib/packages/packages.py\n@@ -1,3 +1,4 @@\n+import dataclasses\n import json\n import ssl\n from typing import Dict, Any, Tuple, List\n@@ -112,4 +113,4 @@\n \texcept SysCallError:\n \t\tpass\n \n-\treturn LocalPackage(**package_info)\n+\treturn LocalPackage({field.name: package_info.get(field.name) for field in dataclasses.fields(LocalPackage)})\n", "issue": "archinstall won't start due to TypeError\n# Error\r\nWhen I execute `archinstall` I get the following error:\r\n\r\n```\r\n...\r\nFile \"/usr/lib/python3.10/site-packages/archinstall/lib/packages/packages.py\", line 115, in installed_package\r\n  return LocalPackage(**package_info)\r\nTypeError: LocalPackage.__init__() got an unexpected keyword argument 'warning'\r\n```\r\n# What I tried\r\nI looked at the code of `installed_package` and found it executes `pacman -Q --info {package}`, so I tried to execute that with archlinux-keyring to see what the output was like.\r\n\r\nI executed `pacman -Q --info archlinux-keyring` and got the following output\r\n```\r\nwarning: config file /etc/pacman.conf, line 19: directive 'SyncFirst' in section 'options' not recognized\r\nName \t: archlinux-keyring\r\nVersion : 20230225-1\r\n...\r\n```\r\n# Why this seems to be happening\r\n## Code\r\nhttps://github.com/archlinux/archinstall/blob/8f6cc07062968b259bebd346521ef685c16f89dc/archinstall/lib/packages/packages.py#L105-L115\r\n## Explanation \r\nBecause the line `warning: config file /etc/pacman.conf, line 19: directive 'SyncFirst' in section 'options' not recognized` I get as part of the output of `pacman -Q --info {package}` has a colon it is being interpreted as a key value pair.\r\n\r\n# Possible fix\r\nIgnore all lines that start with 'warning'\r\n\r\n\n", "before_files": [{"content": "import json\nimport ssl\nfrom typing import Dict, Any, Tuple, List\nfrom urllib.error import HTTPError\nfrom urllib.parse import urlencode\nfrom urllib.request import urlopen\n\nfrom ..exceptions import PackageError, SysCallError\nfrom ..models.dataclasses import PackageSearch, PackageSearchResult, LocalPackage\nfrom ..pacman import run_pacman\n\nBASE_URL_PKG_SEARCH = 'https://archlinux.org/packages/search/json/'\n# BASE_URL_PKG_CONTENT = 'https://archlinux.org/packages/search/json/'\nBASE_GROUP_URL = 'https://archlinux.org/groups/search/json/'\n\n\ndef _make_request(url: str, params: Dict) -> Any:\n\tssl_context = ssl.create_default_context()\n\tssl_context.check_hostname = False\n\tssl_context.verify_mode = ssl.CERT_NONE\n\n\tencoded = urlencode(params)\n\tfull_url = f'{url}?{encoded}'\n\n\treturn urlopen(full_url, context=ssl_context)\n\n\ndef group_search(name :str) -> List[PackageSearchResult]:\n\t# TODO UPSTREAM: Implement /json/ for the groups search\n\ttry:\n\t\tresponse = _make_request(BASE_GROUP_URL, {'name': name})\n\texcept HTTPError as err:\n\t\tif err.code == 404:\n\t\t\treturn []\n\t\telse:\n\t\t\traise err\n\n\t# Just to be sure some code didn't slip through the exception\n\tdata = response.read().decode('UTF-8')\n\n\treturn [PackageSearchResult(**package) for package in json.loads(data)['results']]\n\n\ndef package_search(package :str) -> PackageSearch:\n\t\"\"\"\n\tFinds a specific package via the package database.\n\tIt makes a simple web-request, which might be a bit slow.\n\t\"\"\"\n\t# TODO UPSTREAM: Implement bulk search, either support name=X&name=Y or split on space (%20 or ' ')\n\t# TODO: utilize pacman cache first, upstream second.\n\tresponse = _make_request(BASE_URL_PKG_SEARCH, {'name': package})\n\n\tif response.code != 200:\n\t\traise PackageError(f\"Could not locate package: [{response.code}] {response}\")\n\n\tdata = response.read().decode('UTF-8')\n\n\treturn PackageSearch(**json.loads(data))\n\n\ndef find_package(package :str) -> List[PackageSearchResult]:\n\tdata = package_search(package)\n\tresults = []\n\n\tfor result in data.results:\n\t\tif result.pkgname == package:\n\t\t\tresults.append(result)\n\n\t# If we didn't find the package in the search results,\n\t# odds are it's a group package\n\tif not results:\n\t\t# Check if the package is actually a group\n\t\tfor result in group_search(package):\n\t\t\tresults.append(result)\n\n\treturn results\n\n\ndef find_packages(*names :str) -> Dict[str, Any]:\n\t\"\"\"\n\tThis function returns the search results for many packages.\n\tThe function itself is rather slow, so consider not sending to\n\tmany packages to the search query.\n\t\"\"\"\n\tresult = {}\n\tfor package in names:\n\t\tfor found_package in find_package(package):\n\t\t\tresult[package] = found_package\n\n\treturn result\n\n\ndef validate_package_list(packages :list) -> Tuple[list, list]:\n\t\"\"\"\n\tValidates a list of given packages.\n\treturn: Tuple of lists containing valid packavges in the first and invalid\n\tpackages in the second entry\n\t\"\"\"\n\tvalid_packages = {package for package in packages if find_package(package)}\n\tinvalid_packages = set(packages) - valid_packages\n\n\treturn list(valid_packages), list(invalid_packages)\n\n\ndef installed_package(package :str) -> LocalPackage:\n\tpackage_info = {}\n\ttry:\n\t\tfor line in run_pacman(f\"-Q --info {package}\"):\n\t\t\tif b':' in line:\n\t\t\t\tkey, value = line.decode().split(':', 1)\n\t\t\t\tpackage_info[key.strip().lower().replace(' ', '_')] = value.strip()\n\texcept SysCallError:\n\t\tpass\n\n\treturn LocalPackage(**package_info)\n", "path": "archinstall/lib/packages/packages.py"}]}