From 8b49d6958c844e75bad790b4bb56889cb3877670 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 22 Feb 2025 21:23:05 +0100 Subject: [PATCH] lint --- pubnix.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pubnix.py b/pubnix.py index 448b092..3e27ea7 100644 --- a/pubnix.py +++ b/pubnix.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os from pathlib import Path import subprocess @@ -13,13 +14,13 @@ class PubNix: def __init__( self, dn, - ssh: str = None, + ssh: str | None = None, port: int = PORT, user: str = USER, root: str = ROOT, dir: bool = DIR, - web: str = None, - sub: bool = None, + web: str | None = None, + sub: bool | None = None, ): self.dn = dn self.ssh = f"{ssh}.{self.dn}" if ssh else self.dn @@ -59,15 +60,21 @@ class PubNix: ) def disk_free(self) -> str: + """Fetch free space information.""" process = self.capturun("df", "-h", os.curdir) return process.stdout.decode("UTF-8").strip() def os(self) -> str: + """Fetch Operating System release information.""" ps = self.capturun("cat", "/etc/os-release") if ps.returncode == 0: for line in ps.stdout.decode("UTF-8").strip().split(os.linesep): if "PRETTY_NAME" in line: - return line.split("=")[1].split('"')[1] + text = line.split("=")[1].split('"')[1] + break + else: + text = "" + return text else: return self.capturun("uname", "-sr").stdout.decode("UTF-8").strip()