From 5373b85f906cf23869d5ef37d9338dc8e9c2f1a7 Mon Sep 17 00:00:00 2001 From: Christoph Massmann Date: Wed, 13 Dec 2023 11:06:46 +0100 Subject: [PATCH] improved code style a bit Signed-off-by: Christoph Massmann --- .github/workflows/verify-plugin-scripts.yml | 2 +- src/fritzbox_file_session.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/verify-plugin-scripts.yml b/.github/workflows/verify-plugin-scripts.yml index fb95ed3..d719b43 100644 --- a/.github/workflows/verify-plugin-scripts.yml +++ b/.github/workflows/verify-plugin-scripts.yml @@ -23,7 +23,7 @@ jobs: pip install -r requirements.txt - name: Analysing the code with pylint run: | - pylint --errors-only $(find . -name "*.py" | xargs) + pylint --errors-only $(find src/ -name "*.py" | xargs) - name: Running tests run: | pytest --cov diff --git a/src/fritzbox_file_session.py b/src/fritzbox_file_session.py index 8655eae..69ca9db 100644 --- a/src/fritzbox_file_session.py +++ b/src/fritzbox_file_session.py @@ -6,8 +6,6 @@ import os from typing import Optional -NoneOrString = Optional[str] # for Python 3.9 compatibility, since 3.10 you can type None | str - def get_session_dir() -> str: return str(os.getenv('MUNIN_PLUGSTATE')) + '/fritzbox' @@ -40,7 +38,7 @@ def save(self, session_id): with open(statefilename, 'w', encoding='utf8') as statefile: statefile.write(session_id) - def load(self) -> NoneOrString: + def load(self) -> Optional[str]: statefilename = get_session_dir() + '/' + self.__get_session_filename() if not os.path.exists(statefilename): return None