commit b3806aebb10e68bc6843ef8253793505b08132df Author: KYUNGMO TAK Date: Thu May 7 15:38:03 2026 +0900 First commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fdb404e --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# 20260507 tak created gitignore +.DS_Store +.idea/ +.venv + diff --git a/Custom_Lib.py b/Custom_Lib.py new file mode 100644 index 0000000..b2f7835 --- /dev/null +++ b/Custom_Lib.py @@ -0,0 +1,21 @@ +__version__ = "1.0.0" + +# --- custom --- +from custom_lib import my_file_config +from custom_lib import my_logger +from custom_lib import my_uuid + +MODULES = [ + my_file_config, + my_logger, + my_uuid, +] + +def print_versions(): + for module in MODULES: + version = getattr(module, "__version__", "unknown") + print(f"[MODULE] {module.__name__} v{version}") + +def init(): + print(f"Custom_Lib v{__version__}") + print_versions() \ No newline at end of file diff --git a/__pycache__/Custom_Lib.cpython-39.pyc b/__pycache__/Custom_Lib.cpython-39.pyc new file mode 100644 index 0000000..2279c45 Binary files /dev/null and b/__pycache__/Custom_Lib.cpython-39.pyc differ diff --git a/__pycache__/my_file_config.cpython-39.pyc b/__pycache__/my_file_config.cpython-39.pyc new file mode 100644 index 0000000..aa25096 Binary files /dev/null and b/__pycache__/my_file_config.cpython-39.pyc differ diff --git a/__pycache__/my_logger.cpython-39.pyc b/__pycache__/my_logger.cpython-39.pyc new file mode 100644 index 0000000..a5a78e4 Binary files /dev/null and b/__pycache__/my_logger.cpython-39.pyc differ diff --git a/__pycache__/my_uuid.cpython-39.pyc b/__pycache__/my_uuid.cpython-39.pyc new file mode 100644 index 0000000..f20eae2 Binary files /dev/null and b/__pycache__/my_uuid.cpython-39.pyc differ diff --git a/my_file_config.py b/my_file_config.py new file mode 100644 index 0000000..4de0a3f --- /dev/null +++ b/my_file_config.py @@ -0,0 +1,31 @@ +__version__ = "1.0.0" + +# --- package --- +# --- settings --- +import configparser + +# --- common --- +import os + +def save_config(): + config = configparser.ConfigParser() + + return config + +def write_config(config, file_path, file_nm): + if not os.path.isdir(file_path): + os.makedirs(file_path) + + with open(file_nm, 'w') as f: + config.write(f) + +def read_config(file_nm): + config = configparser.ConfigParser() + config.read(file_nm) + + return config + +# if __name__ == '__main__': +# +# b = read_config('C:/Users/ATECAP/AppData/Local/AeroCodeZ/Weather Crawling/1.0.0/user.config') +# print(b['system']['ems_url']) \ No newline at end of file diff --git a/my_logger.py b/my_logger.py new file mode 100644 index 0000000..7cbb459 --- /dev/null +++ b/my_logger.py @@ -0,0 +1,48 @@ +__version__ = "1.0.0" + +# --- package --- +# --- log --- +import logging + +# --- common --- +from datetime import datetime +import os +from pathlib import Path +import sys + +def logger(): + if not os.path.isdir(log_path): + os.makedirs(log_path) + # return log instance + logger = logging.getLogger('logger') + + exec_nm = Path(os.path.basename(sys.argv[0])).stem + log_date = datetime.strftime('%y%m%d_%H%M%S') + + # define log format + formatter = logging.Formatter('%(asctime)s-%(levelname)s-%(message)s') + + # define handler + stream_handler = logging.StreamHandler() + file_handler = logging.FileHandler(f"{log_path}{exec_nm}_{log_date}.log") + + # define handler format + stream_handler.setFormatter(formatter) + file_handler.setFormatter(formatter) + + # insert handler into logger instance + logger.addHandler(stream_handler) + logger.addHandler(file_handler) + + # define log level + logger.setLevel(level=logging.INFO) + + # return logger + return logger + +# --- path_variables --- +loc_path = os.getcwd() +log_path = f"{loc_path}/log/" + +# --- common_variables --- +datetime = datetime.now() \ No newline at end of file diff --git a/my_uuid.py b/my_uuid.py new file mode 100644 index 0000000..c287761 --- /dev/null +++ b/my_uuid.py @@ -0,0 +1,26 @@ +__version__ = "1.0.0" + +# --- package --- +# --- guid --- +import uuid +import inspect + +def create_uuid(uuid_ver): + # hostid, sequence, timestamp + if uuid_ver == '1': + return uuid.uuid1() + + # namespace, md5 + # elif uuid_ver == '3': + # return uuid.uuid3() + + # random + elif uuid_ver == '4': + return uuid.uuid4() + + # namespace, sha-1 + # elif uuid_ver == '5': + # return uuid.uuid5() + + else: + return f'{inspect.currentframe().f_code.co_name}-Not Found UUID' \ No newline at end of file