Skip to content

Commit

Permalink
update pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
Mips2648 committed Apr 25, 2024
1 parent 932c5c6 commit f265172
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions jeedomdaemon/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Sequence

class BaseConfig():
"""Base config class, if you need custom configuration you can inherit from this class"""
def __init__(self):
self._args = None
self.__parser = argparse.ArgumentParser(description='Daemon for Jeedom plugin')
Expand Down
5 changes: 5 additions & 0 deletions jeedomdaemon/base_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .base_config import BaseConfig

class BaseDaemon:
"""Base daemon class"""
def __init__(self,
config: BaseConfig,
on_start_cb: Callable[...,Awaitable[None]] | None = None,
Expand All @@ -37,13 +38,16 @@ def __init__(self,
logging.getLogger('asyncio').setLevel(logging.WARNING)

def set_logger_log_level(self, logger_name: str):
""" Helper function to set the log level to the given logger"""
logging.getLogger(logger_name).setLevel(self.log_level)

@property
def log_level(self):
""" Return the log level"""
return self.__log_level

def run(self):
""" Run your daemon, this is the function you should call! """
try:
self._logger.info('Starting daemon with log level: %s', self._config.log_level)
Utils.write_pid(str(self._config.pid_filename))
Expand Down Expand Up @@ -86,6 +90,7 @@ async def __run(self):
await self._listen_task

def stop(self):
""" Stop your daemon if need be"""
if self._on_stop_cb is not None:
self._on_stop_cb()

Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pylint: disable=missing-module-docstring

from setuptools import setup, find_packages

setup(
Expand Down

0 comments on commit f265172

Please sign in to comment.