From 485b4c3c6c9c53af695097e59a6cc3fd9bc3d8d7 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 24 Mar 2022 10:39:20 -0600 Subject: [PATCH] Code cleanup --- src/sessionmanager/manager.py | 14 ++++++++++---- src/sessionmanager/sessionManager.py | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/sessionmanager/manager.py b/src/sessionmanager/manager.py index f5e45bb1..57d58156 100644 --- a/src/sessionmanager/manager.py +++ b/src/sessionmanager/manager.py @@ -1,13 +1,15 @@ # -*- coding: cp1252 -*- -import config -import paths +""" Lightweigth module that saves session position across global config and performs validation of config files. """ import os import logging +import config +import paths log = logging.getLogger("sessionmanager.manager") from sessions import session_exceptions manager = None def setup(): + """ Creates the singleton instance used within TWBlue to access this object. """ global manager if not manager: manager = sessionManager() @@ -15,12 +17,16 @@ def setup(): class sessionManager(object): def get_current_session(self): + """ Returns the currently focused session, if valid. """ if self.is_valid(config.app["sessions"]["current_session"]): return config.app["sessions"]["current_session"] - else: - return False def add_session(self, id): + """ Adds a new session to the global config, so it will be taken into account for all operations. + + :param id: Session identified. + :param id: str. + """ log.debug("Adding a new session: %s" % (id,)) path = os.path.join(paths.config_path(), id) if not os.path.exists(path): diff --git a/src/sessionmanager/sessionManager.py b/src/sessionmanager/sessionManager.py index de5c0bfc..711f032f 100644 --- a/src/sessionmanager/sessionManager.py +++ b/src/sessionmanager/sessionManager.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -""" Module to perform session actions such as adddition, removal or display of the global settings dialogue. """ +""" Module to perform session actions such as addition, removal or display of the global settings dialogue. """ import shutil import time import os