Skip to content

Commit

Permalink
Libraries & title corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
impratikjaiswal committed Nov 28, 2023
1 parent a3511c4 commit 466154e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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!

# }**************************************************{
Expand Down
5 changes: 0 additions & 5 deletions requirements_internal_tool.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions requirements_internal_tool_name.txt
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
# tlvPlay
tlvPlay
22 changes: 11 additions & 11 deletions src/main/excelPlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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):
Expand Down Expand Up @@ -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__':
Expand Down
2 changes: 1 addition & 1 deletion src/main/helper/constants_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class ConfigConst:
TOOL_VERSION = '1.1.0'
TOOL_VERSION = '2.0.0'
TOOL_NAME = 'excelPlay'
4 changes: 2 additions & 2 deletions test/test_excelPlay.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)


Expand Down

0 comments on commit 466154e

Please sign in to comment.