Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/partition.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-11-05 15:48:03 +0000
committerGitHub <noreply@github.com>2021-11-05 15:48:03 +0000
commit0071a069080732047e11309134869f3ab40c642c (patch)
tree9ae4cde24f02046ccdc93a988c09273619cd545c /archinstall/lib/disk/partition.py
parent3993917462219de75cd00aefdd4fe318402a22af (diff)
parentb6ab6786316c5e4d8101007c4e96e64585aa7234 (diff)
Merged PR #650 - flake8 fixes and tightening
Tighten up flake8 tests used by GitHub Action lint_python
Diffstat (limited to 'archinstall/lib/disk/partition.py')
-rw-r--r--archinstall/lib/disk/partition.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/archinstall/lib/disk/partition.py b/archinstall/lib/disk/partition.py
index 40a83d6b..afe46db3 100644
--- a/archinstall/lib/disk/partition.py
+++ b/archinstall/lib/disk/partition.py
@@ -4,9 +4,12 @@ import time
import logging
import json
import os
+import hashlib
from typing import Optional
from .blockdevice import BlockDevice
+from .exceptions import DiskError, SysCallError, UnknownFilesystemFormat
from .helpers import get_mount_info, get_filesystem_type
+from .storage import storage
from ..output import log
from ..general import SysCommand
@@ -82,14 +85,14 @@ class Partition:
@property
def sector_size(self):
output = json.loads(SysCommand(f"lsblk --json -o+LOG-SEC {self.path}").decode('UTF-8'))
-
+
for device in output['blockdevices']:
return device.get('log-sec', None)
@property
def start(self):
output = json.loads(SysCommand(f"sfdisk --json {self.block_device.path}").decode('UTF-8'))
-
+
for partition in output.get('partitiontable', {}).get('partitions', []):
if partition['node'] == self.path:
return partition['start']# * self.sector_size
@@ -173,7 +176,7 @@ class Partition:
from .luks import luks2
try:
- with luks2(self, storage.get('ENC_IDENTIFIER', 'ai')+'loop', password, auto_unmount=True) as unlocked_device:
+ with luks2(self, storage.get('ENC_IDENTIFIER', 'ai') + 'loop', password, auto_unmount=True) as unlocked_device:
return unlocked_device.filesystem
except SysCallError:
return None
@@ -346,4 +349,4 @@ class Partition:
pass # We supported it, but /dev/null is not formatable as expected so the mkfs call exited with an error code
except UnknownFilesystemFormat as err:
raise err
- return True \ No newline at end of file
+ return True