Skip to content

Commit 2bdbfc2

Browse files
committed
Refactoring
1 parent 280b59c commit 2bdbfc2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tx_remove_java_pid_hprof/main.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111

1212
from logging.handlers import RotatingFileHandler
1313
from pathlib import Path
14-
from typing import Union
1514

16-
DIR = Path(__file__).resolve().parent
17-
sys.path.append(str(DIR.parent))
18-
from human_byte_size import sizeof_fmt
15+
# pip install humanize
16+
from humanize import naturalsize as sizeof_fmt
1917

2018

2119
def get_logger(
2220
name=__file__,
23-
file: Union[str, Path] = 'log.txt',
21+
file: str | Path = 'log.txt',
2422
formatter: str = '[%(asctime)s] %(filename)s:%(lineno)d %(levelname)-8s %(message)s',
2523
encoding='utf-8',
2624
log_stdout=True,
@@ -44,16 +42,17 @@ def get_logger(
4442
return log
4543

4644

45+
DIR = Path(__file__).resolve().parent
46+
DIRS = [r'C:\DEV__TX', r'C:\DEV__OPTT', r'C:\DEV__RADIX']
47+
48+
4749
log = get_logger(
4850
file=DIR / 'deleted.txt',
4951
formatter='[%(asctime)s] %(message)s',
5052
)
5153

5254

53-
DIRS = [r'C:\DEV__TX', r'C:\DEV__OPTT', r'C:\DEV__RADIX']
54-
55-
56-
def run(dirs: list[Union[str, Path]]):
55+
def run(dirs: list[str | Path]):
5756
print(f'\n{DT.datetime.today()}')
5857

5958
for dir_path in dirs:

0 commit comments

Comments
 (0)