diff --git a/rwx/log/__init__.py b/rwx/log/__init__.py index 12fb781..50048e5 100644 --- a/rwx/log/__init__.py +++ b/rwx/log/__init__.py @@ -1,35 +1,31 @@ -"""Handle logging.""" - import logging import sys def get_file_logger(name: str) -> logging.Logger: - """Return a file logger.""" - # formatter formatter = logging.Formatter( "%(name)s: %(asctime)s | %(levelname)s | %(filename)s:%(lineno)s | %(process)d >>> %(message)s", ) - # handler + # out_handler = logging.StreamHandler(stream=sys.stdout) out_handler.setFormatter(formatter) out_handler.setLevel(logging.INFO) - # logger + # logger = logging.getLogger(name) logger.addHandler(out_handler) logger.setLevel(logging.INFO) + # return logger def get_stream_logger(level: int) -> logging.Logger: - """Return a stream logger.""" - # handler out_handler = logging.StreamHandler(stream=sys.stdout) out_handler.setLevel(level) - # logger + # logger = logging.getLogger() logger.addHandler(out_handler) logger.setLevel(level) + # return logger diff --git a/rwx/ps/__init__.py b/rwx/ps/__init__.py index b2eca55..b66c21b 100644 --- a/rwx/ps/__init__.py +++ b/rwx/ps/__init__.py @@ -1,12 +1,9 @@ -"""Handle processes.""" - import subprocess from rwx import txt -def get_tuples_args(*tuples: tuple[str]) -> list[str]: - """Turn arguments tuples into an arguments list.""" +def get_tuples_args(tuples) -> list[str]: args: list[str] = [] for item in tuples: if type(item) is tuple: @@ -16,21 +13,18 @@ def get_tuples_args(*tuples: tuple[str]) -> list[str]: return args -def run(*tuples: tuple[str]) -> subprocess.CompletedProcess: - """Run from a list of arguments tuples.""" +def run(*tuples) -> subprocess.CompletedProcess: return subprocess.run( get_tuples_args(tuples), capture_output=False, check=True ) -def run_line(*tuples: tuple[str], charset: str = txt.CHARSET) -> str: - """Run and return output line.""" +def run_line(*tuples, charset: str = txt.CHARSET) -> str: lines = run_lines(*get_tuples_args(tuples), charset=charset) return lines[0] -def run_lines(*tuples: tuple[str], charset: str = txt.CHARSET) -> list[str]: - """Run and return output lines.""" +def run_lines(*tuples, charset: str = txt.CHARSET) -> list[str]: process = subprocess.run( get_tuples_args(tuples), capture_output=True, check=True ) diff --git a/rwx/txt/__init__.py b/rwx/txt/__init__.py index be2f273..369202c 100644 --- a/rwx/txt/__init__.py +++ b/rwx/txt/__init__.py @@ -1,3 +1 @@ -"""Handle text.""" - CHARSET = "UTF-8"