diff --git a/.gitignore b/.gitignore index b694934..8f7b11a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.venv \ No newline at end of file +.venv +/**/*.pyc \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index b0cc008..b7d3edf 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "Rings", "type": "debugpy", "request": "launch", - "program": "${workspaceFolder}/__init__.py", + "module": "fledermaus_formatter", "args": ["-i", "data/ringe_short.xlsx", "-o", "ringe_short_out.xlsx", "-t", "ring"], "console": "integratedTerminal" }, @@ -16,7 +16,7 @@ "name": "Countings", "type": "debugpy", "request": "launch", - "program": "${workspaceFolder}/__init__.py", + "module": "fledermaus_formatter", "args": ["-i", "data/zählungen_short.xlsx", "-o", "zählungen_short_out.xlsx", "-t", "counting"], "console": "integratedTerminal" } diff --git a/.~lock.ringe_short_out.xlsx# b/.~lock.ringe_short_out.xlsx# new file mode 100644 index 0000000..a9de537 --- /dev/null +++ b/.~lock.ringe_short_out.xlsx# @@ -0,0 +1 @@ +,someone,nixLap,28.03.2026 12:13,file:///home/someone/.config/yolk/eggs/libreoffice/4; \ No newline at end of file diff --git a/__pycache__/logger.cpython-312.pyc b/__pycache__/logger.cpython-312.pyc deleted file mode 100644 index 7267dd0..0000000 Binary files a/__pycache__/logger.cpython-312.pyc and /dev/null differ diff --git a/data/.~lock.zählungen_short.xlsx# b/data/.~lock.zählungen_short.xlsx# new file mode 100644 index 0000000..a9de537 --- /dev/null +++ b/data/.~lock.zählungen_short.xlsx# @@ -0,0 +1 @@ +,someone,nixLap,28.03.2026 12:13,file:///home/someone/.config/yolk/eggs/libreoffice/4; \ No newline at end of file diff --git a/fledermaus_formatter/__main__.py b/fledermaus_formatter/__main__.py new file mode 100644 index 0000000..b889491 --- /dev/null +++ b/fledermaus_formatter/__main__.py @@ -0,0 +1,4 @@ +from fledermaus_formatter.main import main + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/instructions/__init__.py b/fledermaus_formatter/instructions/__init__.py similarity index 100% rename from instructions/__init__.py rename to fledermaus_formatter/instructions/__init__.py diff --git a/instructions/countings_formater.py b/fledermaus_formatter/instructions/countings_formater.py similarity index 100% rename from instructions/countings_formater.py rename to fledermaus_formatter/instructions/countings_formater.py diff --git a/instructions/mappings.py b/fledermaus_formatter/instructions/mappings.py similarity index 100% rename from instructions/mappings.py rename to fledermaus_formatter/instructions/mappings.py diff --git a/instructions/ring_formater.py b/fledermaus_formatter/instructions/ring_formater.py similarity index 100% rename from instructions/ring_formater.py rename to fledermaus_formatter/instructions/ring_formater.py diff --git a/logger.py b/fledermaus_formatter/logger.py similarity index 100% rename from logger.py rename to fledermaus_formatter/logger.py diff --git a/__init__.py b/fledermaus_formatter/main.py similarity index 91% rename from __init__.py rename to fledermaus_formatter/main.py index 7d477e5..fce2213 100644 --- a/__init__.py +++ b/fledermaus_formatter/main.py @@ -1,10 +1,10 @@ import argparse import os -from logger import logger +from fledermaus_formatter.logger import logger -from table_handler.serializer import TableSerializer -import instructions.countings_formater as countings_formater -import instructions.ring_formater as ring_formater +from fledermaus_formatter.table_handler.serializer import TableSerializer +import fledermaus_formatter.instructions.countings_formater as countings_formater +import fledermaus_formatter.instructions.ring_formater as ring_formater from concurrent.futures import ProcessPoolExecutor, as_completed @@ -97,7 +97,3 @@ def main(): parser.error("You must provide either input/output files or input-dir/output-dir") logger.info("Done") - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/table_handler/__init__.py b/fledermaus_formatter/table_handler/__init__.py similarity index 100% rename from table_handler/__init__.py rename to fledermaus_formatter/table_handler/__init__.py diff --git a/table_handler/commands/copy.py b/fledermaus_formatter/table_handler/commands/copy.py similarity index 100% rename from table_handler/commands/copy.py rename to fledermaus_formatter/table_handler/commands/copy.py diff --git a/table_handler/commands/find_and_replace.py b/fledermaus_formatter/table_handler/commands/find_and_replace.py similarity index 100% rename from table_handler/commands/find_and_replace.py rename to fledermaus_formatter/table_handler/commands/find_and_replace.py diff --git a/table_handler/commands/regex_edit_col.py b/fledermaus_formatter/table_handler/commands/regex_edit_col.py similarity index 100% rename from table_handler/commands/regex_edit_col.py rename to fledermaus_formatter/table_handler/commands/regex_edit_col.py diff --git a/table_handler/commands/regex_group_valuebased_choose.py b/fledermaus_formatter/table_handler/commands/regex_group_valuebased_choose.py similarity index 100% rename from table_handler/commands/regex_group_valuebased_choose.py rename to fledermaus_formatter/table_handler/commands/regex_group_valuebased_choose.py diff --git a/table_handler/commands/regex_move_to_col.py b/fledermaus_formatter/table_handler/commands/regex_move_to_col.py similarity index 100% rename from table_handler/commands/regex_move_to_col.py rename to fledermaus_formatter/table_handler/commands/regex_move_to_col.py diff --git a/table_handler/commands/row_color_to_value.py b/fledermaus_formatter/table_handler/commands/row_color_to_value.py similarity index 100% rename from table_handler/commands/row_color_to_value.py rename to fledermaus_formatter/table_handler/commands/row_color_to_value.py diff --git a/table_handler/conditions/regex_cell.py b/fledermaus_formatter/table_handler/conditions/regex_cell.py similarity index 100% rename from table_handler/conditions/regex_cell.py rename to fledermaus_formatter/table_handler/conditions/regex_cell.py diff --git a/table_handler/serializer.py b/fledermaus_formatter/table_handler/serializer.py similarity index 98% rename from table_handler/serializer.py rename to fledermaus_formatter/table_handler/serializer.py index e71c5c8..0ab61dd 100644 --- a/table_handler/serializer.py +++ b/fledermaus_formatter/table_handler/serializer.py @@ -3,7 +3,7 @@ from openpyxl import Workbook, load_workbook from dataclasses import dataclass from pprint import pprint as print -import instructions.mappings as mappings +import fledermaus_formatter.instructions.mappings as mappings from .commands.find_and_replace import FindAndReplace from .commands.regex_edit_col import RegexEditCol @@ -11,7 +11,7 @@ from .commands.regex_move_to_col import RegexMoveToCol from .commands.copy import Copy from .commands.regex_group_valuebased_choose import RegexGroupValuebasedChoose from .commands.row_color_to_value import RowColorToCalue -from logger import logger +from fledermaus_formatter.logger import logger from .conditions.regex_cell import RegexCellCondition diff --git a/instructions/__pycache__/__init__.cpython-312.pyc b/instructions/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 122812d..0000000 Binary files a/instructions/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/instructions/__pycache__/countings_formater.cpython-312.pyc b/instructions/__pycache__/countings_formater.cpython-312.pyc deleted file mode 100644 index d053f79..0000000 Binary files a/instructions/__pycache__/countings_formater.cpython-312.pyc and /dev/null differ diff --git a/instructions/__pycache__/mappings.cpython-312.pyc b/instructions/__pycache__/mappings.cpython-312.pyc deleted file mode 100644 index 8bfee93..0000000 Binary files a/instructions/__pycache__/mappings.cpython-312.pyc and /dev/null differ diff --git a/instructions/__pycache__/ring_formater.cpython-312.pyc b/instructions/__pycache__/ring_formater.cpython-312.pyc deleted file mode 100644 index 9c4d3d5..0000000 Binary files a/instructions/__pycache__/ring_formater.cpython-312.pyc and /dev/null differ diff --git a/ringe_short_out.xlsx b/ringe_short_out.xlsx new file mode 100644 index 0000000..2273939 Binary files /dev/null and b/ringe_short_out.xlsx differ diff --git a/run.sh b/run.sh index 00e57cb..9e5a094 100755 --- a/run.sh +++ b/run.sh @@ -2,25 +2,6 @@ SCRIPT_DIR="$HOME/.config/fledermaus-formatter" -to_absolute_args() { - local result=() - - for arg in "$@"; do - if [ -e "$arg" ] || [ -d "$arg" ] || [ -f "$arg" ]; then - result+=("$(realpath "$arg")") - else - result+=("$arg") - fi - done - - printf '%s\n' "${result[@]}" -} - -ABS_ARGS=() -while IFS= read -r line; do - ABS_ARGS+=("$line") -done < <(to_absolute_args "$@") - -cd $SCRIPT_DIR source $SCRIPT_DIR/.venv/bin/activate -$SCRIPT_DIR/.venv/bin/python3 __init__.py "${ABS_ARGS[@]}" \ No newline at end of file +export PYTHONPATH=$SCRIPT_DIR:$PYTHONPATH +$SCRIPT_DIR/.venv/bin/python3 -m fledermaus_formatter "${ABS_ARGS[@]}" \ No newline at end of file diff --git a/table_handler/__pycache__/__init__.cpython-312.pyc b/table_handler/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index a8121bd..0000000 Binary files a/table_handler/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/table_handler/__pycache__/serializer.cpython-312.pyc b/table_handler/__pycache__/serializer.cpython-312.pyc deleted file mode 100644 index 2008f80..0000000 Binary files a/table_handler/__pycache__/serializer.cpython-312.pyc and /dev/null differ diff --git a/table_handler/commands/__pycache__/copy.cpython-312.pyc b/table_handler/commands/__pycache__/copy.cpython-312.pyc deleted file mode 100644 index 2d12a12..0000000 Binary files a/table_handler/commands/__pycache__/copy.cpython-312.pyc and /dev/null differ diff --git a/table_handler/commands/__pycache__/find_and_replace.cpython-312.pyc b/table_handler/commands/__pycache__/find_and_replace.cpython-312.pyc deleted file mode 100644 index 246030c..0000000 Binary files a/table_handler/commands/__pycache__/find_and_replace.cpython-312.pyc and /dev/null differ diff --git a/table_handler/commands/__pycache__/regex_edit_col.cpython-312.pyc b/table_handler/commands/__pycache__/regex_edit_col.cpython-312.pyc deleted file mode 100644 index b39a6d8..0000000 Binary files a/table_handler/commands/__pycache__/regex_edit_col.cpython-312.pyc and /dev/null differ diff --git a/table_handler/commands/__pycache__/regex_group_valuebased_choose.cpython-312.pyc b/table_handler/commands/__pycache__/regex_group_valuebased_choose.cpython-312.pyc deleted file mode 100644 index 9cb2ea2..0000000 Binary files a/table_handler/commands/__pycache__/regex_group_valuebased_choose.cpython-312.pyc and /dev/null differ diff --git a/table_handler/commands/__pycache__/regex_move_to_col.cpython-312.pyc b/table_handler/commands/__pycache__/regex_move_to_col.cpython-312.pyc deleted file mode 100644 index cea26d4..0000000 Binary files a/table_handler/commands/__pycache__/regex_move_to_col.cpython-312.pyc and /dev/null differ diff --git a/table_handler/commands/__pycache__/row_color_to_value.cpython-312.pyc b/table_handler/commands/__pycache__/row_color_to_value.cpython-312.pyc deleted file mode 100644 index e0f992c..0000000 Binary files a/table_handler/commands/__pycache__/row_color_to_value.cpython-312.pyc and /dev/null differ diff --git a/table_handler/conditions/__pycache__/regex_cell.cpython-312.pyc b/table_handler/conditions/__pycache__/regex_cell.cpython-312.pyc deleted file mode 100644 index 72af07a..0000000 Binary files a/table_handler/conditions/__pycache__/regex_cell.cpython-312.pyc and /dev/null differ diff --git a/zählungen_short_out.xlsx b/zählungen_short_out.xlsx new file mode 100644 index 0000000..50da9be Binary files /dev/null and b/zählungen_short_out.xlsx differ