pyonair / PyonAir-pycom

http://www.PyonAir.org
Apache License 2.0
8 stars 3 forks source link

why? #116

Open github-actions[bot] opened 2 years ago

github-actions[bot] commented 2 years ago

why?

https://github.com/pyonair/PyonAir-pycom/blob/9b8cd7f8cb06d958981c1841ca740c9ae1cf723d/code/lib/Configuration.py#L29


import os

import strings as s
import ujson

# from ubinascii import hexlify
# from machine import unique_id
# from network import LoRa
from Constants import (
    CONFIG_FILE_DIRECTORY,
    CONFIG_FILE_FULL_NAME,
    CONFIG_FILE_NAME,
    DEBUG_CONFIG_FILE_DIRECTORY,
    DEBUG_CONFIG_FILE_FULL_NAME,
    DEBUG_CONFIG_FILE_NAME,
    DEFAULT_CONFIG,
)

# import imp

# TODO: memory hog, sort this class - static?

class ConfigurationException(Exception):
    """
    Exception to be thrown if Exception occurs in configuration
    """

    # TODO: why?
    pass

# Configuration
class Configuration:
    def __init__(self, logger):
        self.logger = logger
        self.configuration = {}
        # RM

        self.read_configuration()
        print("CONFIG READ########################################")

    # Configuration Accessor/Getter
    def get_config(self, keys=None):

        """

        If keys are given, return corresponding values in a list, if one key is given, return the corresponding value,
        if no arguments are given, return the config dictionary
        :param keys: keys in configuration dictionary

a0d19e78c9fc737579743c79f536a3b9fe0d1e7b