From 2262cd6196dd487b3dfc4524de1eea9b747db0c0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 7 Feb 2021 15:05:23 +0100 Subject: Made BlockDevices() iterable, iterting over each partition --- archinstall/lib/disk.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'archinstall/lib/disk.py') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 588054a0..ffd3e044 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -22,6 +22,10 @@ class BlockDevice(): def __repr__(self, *args, **kwargs): return f"BlockDevice({self.device})" + def __iter__(self): + for partition in self.partitions: + yield partition + def __getitem__(self, key, *args, **kwargs): if key not in self.info: raise KeyError(f'{self} does not contain information: "{key}"') -- cgit v1.2.3-54-g00ecf