Fixed cross-import issue

This commit is contained in:
2022-09-15 12:55:33 +02:00
parent 02d945aef5
commit e9d083c156
3 changed files with 15 additions and 18 deletions

View File

@@ -10,8 +10,6 @@ from shutil import copyfileobj
from gzip import open as gzipopen
from psutil import Process
from modules.functions_bot import configGet
def nowtimeGet(format="%H:%M:%S | %d.%m.%Y") -> str:
"""Return current local time formatted as arg.
@@ -25,7 +23,7 @@ def nowtimeGet(format="%H:%M:%S | %d.%m.%Y") -> str:
return datetime.now().strftime(format)
def checkSize(logs_folder=f"{configGet('logs')}{sep}", log_size=1024) -> None:
def checkSize(logs_folder=f"logs{sep}", log_size=1024) -> None:
"""Checks latest log file size and rotates it if needed.
### Args:
@@ -56,7 +54,7 @@ def checkSize(logs_folder=f"{configGet('logs')}{sep}", log_size=1024) -> None:
i += 1
def logWrite(message: str, logs_folder=f"{configGet('logs')}{sep}", level="INFO") -> None:
def logWrite(message: str, logs_folder=f"logs{sep}", level="INFO") -> None:
"""Append some message to latest log file.
### Args:

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
"""Essential set of functions needed for discord/telegram bots and other types of apps"""
from types import NoneType
from typing import Union
from modules.functions import jsonLoad, jsonSave
from os import sep, listdir
@@ -22,7 +21,7 @@ def configGet(key: str, *args: str) -> any:
return this_key[key]
def configAppend(key: str, value: Union[str, float, int, bool, dict, list, NoneType], *args: str) -> None:
def configAppend(key: str, value: Union[str, float, int, bool, dict, list, None], *args: str) -> None:
"""Set key to a value
### Args:
* key (str): The last key of the keys path.
@@ -42,7 +41,7 @@ def configAppend(key: str, value: Union[str, float, int, bool, dict, list, NoneT
return
def configRemove(key: str, value: Union[str, float, int, bool, dict, list, NoneType]) -> None:
def configRemove(key: str, value: Union[str, float, int, bool, dict, list, None]) -> None:
"""Remove value from config's list key
### Args:
@@ -86,7 +85,7 @@ def locale(key: str, *args: str, locale=configGet("locale")) -> str:
return f'⚠ Locale in config is invalid: could not get "{key}" in {str(args)} from locale "{locale}"'
def userSet(userid: Union[str, int], key: str, value: Union[str, float, int, bool, dict, list, NoneType]) -> None:
def userSet(userid: Union[str, int], key: str, value: Union[str, float, int, bool, dict, list, None]) -> None:
"""Set user's variable
### Args:
@@ -135,7 +134,7 @@ def userClear(userid: Union[str, int], key: str) -> None:
pass
def localeName(command: str, option: Union[str, NoneType]):
def localeName(command: str, option: Union[str, None]):
"""Get name of a command or command's option
### Args:
@@ -158,7 +157,7 @@ def localeName(command: str, option: Union[str, NoneType]):
return output
def localeDescription(command: str, option: Union[str, NoneType]):
def localeDescription(command: str, option: Union[str, None]):
"""Get description of a command or command's option
### Args: