From 23195805be5e5cd4c685c129fded4430a7c5f81f Mon Sep 17 00:00:00 2001 From: Malte Bublitz Date: Thu, 26 Oct 2023 15:32:53 +0200 Subject: [PATCH] Docstrings for mapid.py --- mapid.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mapid.py b/mapid.py index 058c4e3..91963ff 100644 --- a/mapid.py +++ b/mapid.py @@ -1,3 +1,8 @@ +"""MAPID utility library. + +This module contains an utility class to control MAPID/CP using pyserial. +""" + import os import time import dotenv # @@ -5,8 +10,15 @@ import serial DOTENV_LOADED = False +"""bool: Is .env loaded? + +Prevents loading .env multiple times for speed. +""" + def load_dotenv(): + """Load .env file + """ basedir = os.path.abspath(os.path.dirname(__file__)) dotenv.load_dotenv(os.path.join(basedir, ".env")) global DOTENV_LOADED @@ -14,6 +26,12 @@ def load_dotenv(): def get_serial_dev(): + """Get SERIAL_DEV setting from dotenv. + + Returns: + str: The device file. + + """ global DOTENV_LOADED if not DOTENV_LOADED: load_dotenv() @@ -21,6 +39,12 @@ def get_serial_dev(): def get_serial_speed(): + """Get SERIAL_SPEED setting from dotenv. + + Returns: + int: Serial speed in baud. + + """ global DOTENV_LOADED if not DOTENV_LOADED: load_dotenv()