From 9c1136cfa0b978c9ed85311209dcdc6518f7bef6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 14 Sep 2024 15:41:56 +0200 Subject: [PATCH] staticmethod --- rwx/os/__init__.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rwx/os/__init__.py b/rwx/os/__init__.py index 3bd3c15..d13857c 100644 --- a/rwx/os/__init__.py +++ b/rwx/os/__init__.py @@ -1,10 +1,15 @@ """Control Operating Systems.""" -from pathlib import Path +from __future__ import annotations + +from typing import TYPE_CHECKING from rwx.err import Error from rwx.os.debian import Debian +if TYPE_CHECKING: + from pathlib import Path + class OS: """Operating System.""" @@ -18,7 +23,7 @@ class OS: """Return mandatory name.""" raise Error - -def from_path(path: Path) -> OS: - """Initialize from an already existing path.""" - return Debian(path) + @staticmethod + def from_path(path: Path) -> OS: + """Initialize from an already existing path.""" + return Debian(path)