From 466154eca47e1b5a225dc81f2a8f096ac053fa36 Mon Sep 17 00:00:00 2001 From: imPratik Date: Tue, 28 Nov 2023 10:10:40 +0530 Subject: [PATCH] Libraries & title corrected --- _config.yml | 2 +- requirements_internal_tool.txt | 5 ----- requirements_internal_tool_name.txt | 2 -- src/main/excelPlay.py | 22 +++++++++++----------- src/main/helper/constants_config.py | 2 +- test/test_excelPlay.py | 4 ++-- 6 files changed, 15 insertions(+), 22 deletions(-) diff --git a/_config.yml b/_config.yml index 5149bf1..4ad0fdd 100644 --- a/_config.yml +++ b/_config.yml @@ -9,7 +9,7 @@ plugins: remote_theme: pages-themes/architect@v0.2.0 # }**************************************************{ -title: [Excel Play] +title: Excel Play description: Bookmark this to keep an eye on my project updates! # }**************************************************{ diff --git a/requirements_internal_tool.txt b/requirements_internal_tool.txt index d44d669..e69de29 100644 --- a/requirements_internal_tool.txt +++ b/requirements_internal_tool.txt @@ -1,5 +0,0 @@ -# tlvPlay Tool From Specific Tag (Remove @ String for Main Branch); Public Repo -git+https://github.com/impratikjaiswal/tlvPlay@v2.2.1 - -# tlvPlay Tool From Local Path -# D:\Other\Github_Self\tlvPlay diff --git a/requirements_internal_tool_name.txt b/requirements_internal_tool_name.txt index c06d878..e69de29 100644 --- a/requirements_internal_tool_name.txt +++ b/requirements_internal_tool_name.txt @@ -1,2 +0,0 @@ -# tlvPlay -tlvPlay diff --git a/src/main/excelPlay.py b/src/main/excelPlay.py index 34cebc0..c65e53b 100644 --- a/src/main/excelPlay.py +++ b/src/main/excelPlay.py @@ -2,8 +2,7 @@ import click import pandas as pd -from util_helpers.util import print_done, print_version, print_version_pkg, print_separator, traverse_it, \ - get_file_name_and_extn, makedirs +from python_helpers.ph_util import PhUtil from src.main.helper.constants_config import ConfigConst from src.main.helper.defaults import Defaults @@ -17,19 +16,19 @@ def get_sheets(input_file_or_folder, target_file_format, output_parent_folder=No include_files = [item for item in Formats.SUPPORTED_FORMATS if item not in [target_file_format]] include_files = [f'*.{item}' for item in include_files] if is_dir: - files_list = traverse_it(top=input_file_or_folder, include_files=include_files) + files_list = PhUtil.traverse_it(top=input_file_or_folder, include_files=include_files) else: files_list = [input_file_or_folder] if output_parent_folder is None: output_parent_folder = '' for file_path in files_list: - folder_path = get_file_name_and_extn(file_path=file_path, path_with_out_extn=True) - file_name = get_file_name_and_extn(file_path=file_path, name_with_out_extn=True) + folder_path = PhUtil.get_file_name_and_extn(file_path=file_path, path_with_out_extn=True) + file_name = PhUtil.get_file_name_and_extn(file_path=file_path, name_with_out_extn=True) if output_parent_folder: folder_path = os.sep.join([output_parent_folder, file_name]) - makedirs(folder_path) + PhUtil.makedirs(folder_path) df1 = pd.ExcelFile(file_path) - print_separator(main_text=file_path) + PhUtil.print_separator(main_text=file_path) for x in df1.sheet_names: print(f'{x}.{target_file_format} Done.') df2 = pd.read_excel(file_path, sheet_name=x, dtype='str', na_filter=False) @@ -38,7 +37,7 @@ def get_sheets(input_file_or_folder, target_file_format, output_parent_folder=No df2.to_csv(filename, index=False) else: df2.to_excel(filename, index=False) - print_done() + PhUtil.print_done() def process_input(input_file_or_folder, target_file_format=Defaults.DEFAULT_FORMAT, output_parent_folder=None): @@ -67,10 +66,11 @@ def main(): :return: """ - print_version(ConfigConst.TOOL_NAME, ConfigConst.TOOL_VERSION) - print_version_pkg(with_python_version=False) + # Print Versions + PhUtil.print_version(ConfigConst.TOOL_NAME, ConfigConst.TOOL_VERSION) + # Process Data cli() - print_done() + PhUtil.print_done() if __name__ == '__main__': diff --git a/src/main/helper/constants_config.py b/src/main/helper/constants_config.py index 0afed2e..d5a22fa 100644 --- a/src/main/helper/constants_config.py +++ b/src/main/helper/constants_config.py @@ -1,3 +1,3 @@ class ConfigConst: - TOOL_VERSION = '1.1.0' + TOOL_VERSION = '2.0.0' TOOL_NAME = 'excelPlay' diff --git a/test/test_excelPlay.py b/test/test_excelPlay.py index f674756..65c1884 100644 --- a/test/test_excelPlay.py +++ b/test/test_excelPlay.py @@ -1,6 +1,6 @@ import os -from util_helpers.util import path_default_log_folder +from python_helpers.ph_util import PhUtil from src.main.excelPlay import process_input @@ -20,7 +20,7 @@ def main(): :return: """ for index, input_item in enumerate(input_items_list): - out_folder_path = os.sep.join([path_default_log_folder, f'TC_{index}']) + out_folder_path = os.sep.join([PhUtil.path_default_log_folder, f'TC_{index}']) process_input(input_file_or_folder=input_item, output_parent_folder=out_folder_path)