prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  `select_disk` throw an error because BlockDevice does not contain label
  Running this line from a python script causes an error: 
  
  `archinstall.select_disk(archinstall.all_blockdevices())`
  
  
  ```
  Traceback (most recent call last):
    File "/root/test.py", line 3, in <module>
      hdd = archinstall.select_disk(archinstall.all_blockdevices())
    File "/usr/lib/python3.10/site-packages/archinstall/lib/user_interaction/disk_conf.py", line 68, in select_disk
      f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})"
    File "/usr/lib/python3.10/site-packages/archinstall/lib/disk/blockdevice.py", line 45, in __getitem__
      raise KeyError(f'{self} does not contain information: "{key}"')
  KeyError: 'BlockDevice(/dev/sr0, size=0.8GB, free_space=, bus_type=sata) does not contain information: "label"'
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `archinstall/lib/user_interaction/disk_conf.py`
  Content:
  ```
  1 from __future__ import annotations
  2 
  3 from typing import Any, Dict, TYPE_CHECKING, Optional
  4 
  5 from .partitioning_conf import manage_new_and_existing_partitions, get_default_partition_layout
  6 from ..disk import BlockDevice
  7 from ..exceptions import DiskError
  8 from ..menu import Menu
  9 from ..menu.menu import MenuSelectionType
  10 from ..output import log
  11 
  12 if TYPE_CHECKING:
  13 	_: Any
  14 
  15 
  16 def ask_for_main_filesystem_format(advanced_options=False) -> str:
  17 	options = {'btrfs': 'btrfs', 'ext4': 'ext4', 'xfs': 'xfs', 'f2fs': 'f2fs'}
  18 
  19 	advanced = {'ntfs': 'ntfs'}
  20 
  21 	if advanced_options:
  22 		options.update(advanced)
  23 
  24 	prompt = _('Select which filesystem your main partition should use')
  25 	choice = Menu(prompt, options, skip=False).run()
  26 	return choice.value
  27 
  28 
  29 def select_individual_blockdevice_usage(block_devices: list) -> Dict[str, Any]:
  30 	result = {}
  31 
  32 	for device in block_devices:
  33 		layout = manage_new_and_existing_partitions(device)
  34 		result[device.path] = layout
  35 
  36 	return result
  37 
  38 
  39 def select_disk_layout(preset: Optional[Dict[str, Any]], block_devices: list, advanced_options=False) -> Optional[Dict[str, Any]]:
  40 	wipe_mode = str(_('Wipe all selected drives and use a best-effort default partition layout'))
  41 	custome_mode = str(_('Select what to do with each individual drive (followed by partition usage)'))
  42 	modes = [wipe_mode, custome_mode]
  43 
  44 	warning = str(_('Are you sure you want to reset this setting?'))
  45 
  46 	choice = Menu(
  47 		_('Select what you wish to do with the selected block devices'),
  48 		modes,
  49 		explode_on_interrupt=True,
  50 		explode_warning=warning
  51 	).run()
  52 
  53 	match choice.type_:
  54 		case MenuSelectionType.Esc: return preset
  55 		case MenuSelectionType.Ctrl_c: return None
  56 		case MenuSelectionType.Selection:
  57 			if choice.value == wipe_mode:
  58 				return get_default_partition_layout(block_devices, advanced_options)
  59 			else:
  60 				return select_individual_blockdevice_usage(block_devices)
  61 
  62 
  63 def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> BlockDevice:
  64 	"""
  65 	Asks the user to select a harddrive from the `dict_o_disks` selection.
  66 	Usually this is combined with :ref:`archinstall.list_drives`.
  67 
  68 	:param dict_o_disks: A `dict` where keys are the drive-name, value should be a dict containing drive information.
  69 	:type dict_o_disks: dict
  70 
  71 	:return: The name/path (the dictionary key) of the selected drive
  72 	:rtype: str
  73 	"""
  74 	drives = sorted(list(dict_o_disks.keys()))
  75 	if len(drives) >= 1:
  76 		for index, drive in enumerate(drives):
  77 			print(
  78 				f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})"
  79 			)
  80 
  81 		log("You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)",
  82 			fg="yellow")
  83 
  84 		drive = Menu('Select one of the disks or skip and use "/mnt" as default"', drives).run()
  85 		if not drive:
  86 			return drive
  87 
  88 		drive = dict_o_disks[drive]
  89 		return drive
  90 
  91 	raise DiskError('select_disk() requires a non-empty dictionary of disks to select from.')
  92
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/archinstall/lib/user_interaction/disk_conf.py b/archinstall/lib/user_interaction/disk_conf.py
  --- a/archinstall/lib/user_interaction/disk_conf.py
  +++ b/archinstall/lib/user_interaction/disk_conf.py
  @@ -7,7 +7,6 @@
   from ..exceptions import DiskError
   from ..menu import Menu
   from ..menu.menu import MenuSelectionType
  -from ..output import log
   
   if TYPE_CHECKING:
   	_: Any
  @@ -60,7 +59,7 @@
   				return select_individual_blockdevice_usage(block_devices)
   
   
  -def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> BlockDevice:
  +def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> Optional[BlockDevice]:
   	"""
   	Asks the user to select a harddrive from the `dict_o_disks` selection.
   	Usually this is combined with :ref:`archinstall.list_drives`.
  @@ -73,19 +72,15 @@
   	"""
   	drives = sorted(list(dict_o_disks.keys()))
   	if len(drives) >= 1:
  -		for index, drive in enumerate(drives):
  -			print(
  -				f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})"
  -			)
  +		title = str(_('You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)')) + '\n'
  +		title += str(_('Select one of the disks or skip and use /mnt as default'))
   
  -		log("You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)",
  -			fg="yellow")
  +		choice = Menu(title, drives).run()
   
  -		drive = Menu('Select one of the disks or skip and use "/mnt" as default"', drives).run()
  -		if not drive:
  -			return drive
  +		if choice.type_ == MenuSelectionType.Esc:
  +			return None
   
  -		drive = dict_o_disks[drive]
  +		drive = dict_o_disks[choice.value]
   		return drive
   
   	raise DiskError('select_disk() requires a non-empty dictionary of disks to select from.')
  
verification_info: {"golden_diff": "diff --git a/archinstall/lib/user_interaction/disk_conf.py b/archinstall/lib/user_interaction/disk_conf.py\n--- a/archinstall/lib/user_interaction/disk_conf.py\n+++ b/archinstall/lib/user_interaction/disk_conf.py\n@@ -7,7 +7,6 @@\n from ..exceptions import DiskError\n from ..menu import Menu\n from ..menu.menu import MenuSelectionType\n-from ..output import log\n \n if TYPE_CHECKING:\n \t_: Any\n@@ -60,7 +59,7 @@\n \t\t\t\treturn select_individual_blockdevice_usage(block_devices)\n \n \n-def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> BlockDevice:\n+def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> Optional[BlockDevice]:\n \t\"\"\"\n \tAsks the user to select a harddrive from the `dict_o_disks` selection.\n \tUsually this is combined with :ref:`archinstall.list_drives`.\n@@ -73,19 +72,15 @@\n \t\"\"\"\n \tdrives = sorted(list(dict_o_disks.keys()))\n \tif len(drives) >= 1:\n-\t\tfor index, drive in enumerate(drives):\n-\t\t\tprint(\n-\t\t\t\tf\"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})\"\n-\t\t\t)\n+\t\ttitle = str(_('You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)')) + '\\n'\n+\t\ttitle += str(_('Select one of the disks or skip and use /mnt as default'))\n \n-\t\tlog(\"You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)\",\n-\t\t\tfg=\"yellow\")\n+\t\tchoice = Menu(title, drives).run()\n \n-\t\tdrive = Menu('Select one of the disks or skip and use \"/mnt\" as default\"', drives).run()\n-\t\tif not drive:\n-\t\t\treturn drive\n+\t\tif choice.type_ == MenuSelectionType.Esc:\n+\t\t\treturn None\n \n-\t\tdrive = dict_o_disks[drive]\n+\t\tdrive = dict_o_disks[choice.value]\n \t\treturn drive\n \n \traise DiskError('select_disk() requires a non-empty dictionary of disks to select from.')\n", "issue": "`select_disk` throw an error because BlockDevice does not contain label\nRunning this line from a python script causes an error: \r\n\r\n`archinstall.select_disk(archinstall.all_blockdevices())`\r\n\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/root/test.py\", line 3, in <module>\r\n    hdd = archinstall.select_disk(archinstall.all_blockdevices())\r\n  File \"/usr/lib/python3.10/site-packages/archinstall/lib/user_interaction/disk_conf.py\", line 68, in select_disk\r\n    f\"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})\"\r\n  File \"/usr/lib/python3.10/site-packages/archinstall/lib/disk/blockdevice.py\", line 45, in __getitem__\r\n    raise KeyError(f'{self} does not contain information: \"{key}\"')\r\nKeyError: 'BlockDevice(/dev/sr0, size=0.8GB, free_space=, bus_type=sata) does not contain information: \"label\"'\r\n```\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom typing import Any, Dict, TYPE_CHECKING, Optional\n\nfrom .partitioning_conf import manage_new_and_existing_partitions, get_default_partition_layout\nfrom ..disk import BlockDevice\nfrom ..exceptions import DiskError\nfrom ..menu import Menu\nfrom ..menu.menu import MenuSelectionType\nfrom ..output import log\n\nif TYPE_CHECKING:\n\t_: Any\n\n\ndef ask_for_main_filesystem_format(advanced_options=False) -> str:\n\toptions = {'btrfs': 'btrfs', 'ext4': 'ext4', 'xfs': 'xfs', 'f2fs': 'f2fs'}\n\n\tadvanced = {'ntfs': 'ntfs'}\n\n\tif advanced_options:\n\t\toptions.update(advanced)\n\n\tprompt = _('Select which filesystem your main partition should use')\n\tchoice = Menu(prompt, options, skip=False).run()\n\treturn choice.value\n\n\ndef select_individual_blockdevice_usage(block_devices: list) -> Dict[str, Any]:\n\tresult = {}\n\n\tfor device in block_devices:\n\t\tlayout = manage_new_and_existing_partitions(device)\n\t\tresult[device.path] = layout\n\n\treturn result\n\n\ndef select_disk_layout(preset: Optional[Dict[str, Any]], block_devices: list, advanced_options=False) -> Optional[Dict[str, Any]]:\n\twipe_mode = str(_('Wipe all selected drives and use a best-effort default partition layout'))\n\tcustome_mode = str(_('Select what to do with each individual drive (followed by partition usage)'))\n\tmodes = [wipe_mode, custome_mode]\n\n\twarning = str(_('Are you sure you want to reset this setting?'))\n\n\tchoice = Menu(\n\t\t_('Select what you wish to do with the selected block devices'),\n\t\tmodes,\n\t\texplode_on_interrupt=True,\n\t\texplode_warning=warning\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Esc: return preset\n\t\tcase MenuSelectionType.Ctrl_c: return None\n\t\tcase MenuSelectionType.Selection:\n\t\t\tif choice.value == wipe_mode:\n\t\t\t\treturn get_default_partition_layout(block_devices, advanced_options)\n\t\t\telse:\n\t\t\t\treturn select_individual_blockdevice_usage(block_devices)\n\n\ndef select_disk(dict_o_disks: Dict[str, BlockDevice]) -> BlockDevice:\n\t\"\"\"\n\tAsks the user to select a harddrive from the `dict_o_disks` selection.\n\tUsually this is combined with :ref:`archinstall.list_drives`.\n\n\t:param dict_o_disks: A `dict` where keys are the drive-name, value should be a dict containing drive information.\n\t:type dict_o_disks: dict\n\n\t:return: The name/path (the dictionary key) of the selected drive\n\t:rtype: str\n\t\"\"\"\n\tdrives = sorted(list(dict_o_disks.keys()))\n\tif len(drives) >= 1:\n\t\tfor index, drive in enumerate(drives):\n\t\t\tprint(\n\t\t\t\tf\"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})\"\n\t\t\t)\n\n\t\tlog(\"You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)\",\n\t\t\tfg=\"yellow\")\n\n\t\tdrive = Menu('Select one of the disks or skip and use \"/mnt\" as default\"', drives).run()\n\t\tif not drive:\n\t\t\treturn drive\n\n\t\tdrive = dict_o_disks[drive]\n\t\treturn drive\n\n\traise DiskError('select_disk() requires a non-empty dictionary of disks to select from.')\n", "path": "archinstall/lib/user_interaction/disk_conf.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import Any, Dict, TYPE_CHECKING, Optional\n\nfrom .partitioning_conf import manage_new_and_existing_partitions, get_default_partition_layout\nfrom ..disk import BlockDevice\nfrom ..exceptions import DiskError\nfrom ..menu import Menu\nfrom ..menu.menu import MenuSelectionType\n\nif TYPE_CHECKING:\n\t_: Any\n\n\ndef ask_for_main_filesystem_format(advanced_options=False) -> str:\n\toptions = {'btrfs': 'btrfs', 'ext4': 'ext4', 'xfs': 'xfs', 'f2fs': 'f2fs'}\n\n\tadvanced = {'ntfs': 'ntfs'}\n\n\tif advanced_options:\n\t\toptions.update(advanced)\n\n\tprompt = _('Select which filesystem your main partition should use')\n\tchoice = Menu(prompt, options, skip=False).run()\n\treturn choice.value\n\n\ndef select_individual_blockdevice_usage(block_devices: list) -> Dict[str, Any]:\n\tresult = {}\n\n\tfor device in block_devices:\n\t\tlayout = manage_new_and_existing_partitions(device)\n\t\tresult[device.path] = layout\n\n\treturn result\n\n\ndef select_disk_layout(preset: Optional[Dict[str, Any]], block_devices: list, advanced_options=False) -> Optional[Dict[str, Any]]:\n\twipe_mode = str(_('Wipe all selected drives and use a best-effort default partition layout'))\n\tcustome_mode = str(_('Select what to do with each individual drive (followed by partition usage)'))\n\tmodes = [wipe_mode, custome_mode]\n\n\twarning = str(_('Are you sure you want to reset this setting?'))\n\n\tchoice = Menu(\n\t\t_('Select what you wish to do with the selected block devices'),\n\t\tmodes,\n\t\texplode_on_interrupt=True,\n\t\texplode_warning=warning\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Esc: return preset\n\t\tcase MenuSelectionType.Ctrl_c: return None\n\t\tcase MenuSelectionType.Selection:\n\t\t\tif choice.value == wipe_mode:\n\t\t\t\treturn get_default_partition_layout(block_devices, advanced_options)\n\t\t\telse:\n\t\t\t\treturn select_individual_blockdevice_usage(block_devices)\n\n\ndef select_disk(dict_o_disks: Dict[str, BlockDevice]) -> Optional[BlockDevice]:\n\t\"\"\"\n\tAsks the user to select a harddrive from the `dict_o_disks` selection.\n\tUsually this is combined with :ref:`archinstall.list_drives`.\n\n\t:param dict_o_disks: A `dict` where keys are the drive-name, value should be a dict containing drive information.\n\t:type dict_o_disks: dict\n\n\t:return: The name/path (the dictionary key) of the selected drive\n\t:rtype: str\n\t\"\"\"\n\tdrives = sorted(list(dict_o_disks.keys()))\n\tif len(drives) >= 1:\n\t\ttitle = str(_('You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)')) + '\\n'\n\t\ttitle += str(_('Select one of the disks or skip and use /mnt as default'))\n\n\t\tchoice = Menu(title, drives).run()\n\n\t\tif choice.type_ == MenuSelectionType.Esc:\n\t\t\treturn None\n\n\t\tdrive = dict_o_disks[choice.value]\n\t\treturn drive\n\n\traise DiskError('select_disk() requires a non-empty dictionary of disks to select from.')\n", "path": "archinstall/lib/user_interaction/disk_conf.py"}]}