Compare commits
No commits in common. "7a7479314da02af59d7fbfc7dd4d56f4b78353bf" and "1e833ebc7f7d190c46d7366b110e17c040d9bf96" have entirely different histories.
7a7479314d
...
1e833ebc7f
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1 @@
|
||||
.venv
|
||||
/**/*.pyc
|
||||
.venv
|
||||
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@ -8,7 +8,7 @@
|
||||
"name": "Rings",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"module": "fledermaus_formatter",
|
||||
"program": "${workspaceFolder}/__init__.py",
|
||||
"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",
|
||||
"module": "fledermaus_formatter",
|
||||
"program": "${workspaceFolder}/__init__.py",
|
||||
"args": ["-i", "data/zählungen_short.xlsx", "-o", "zählungen_short_out.xlsx", "-t", "counting"],
|
||||
"console": "integratedTerminal"
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import argparse
|
||||
import os
|
||||
from fledermaus_formatter.logger import logger
|
||||
from logger import logger
|
||||
|
||||
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 table_handler.serializer import TableSerializer
|
||||
import instructions.countings_formater as countings_formater
|
||||
import instructions.ring_formater as ring_formater
|
||||
|
||||
from concurrent.futures import ProcessPoolExecutor, as_completed
|
||||
|
||||
@ -97,3 +97,7 @@ def main():
|
||||
parser.error("You must provide either input/output files or input-dir/output-dir")
|
||||
|
||||
logger.info("Done")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
BIN
__pycache__/logger.cpython-312.pyc
Normal file
BIN
__pycache__/logger.cpython-312.pyc
Normal file
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
from fledermaus_formatter.main import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
BIN
instructions/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
instructions/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
instructions/__pycache__/countings_formater.cpython-312.pyc
Normal file
BIN
instructions/__pycache__/countings_formater.cpython-312.pyc
Normal file
Binary file not shown.
BIN
instructions/__pycache__/mappings.cpython-312.pyc
Normal file
BIN
instructions/__pycache__/mappings.cpython-312.pyc
Normal file
Binary file not shown.
BIN
instructions/__pycache__/ring_formater.cpython-312.pyc
Normal file
BIN
instructions/__pycache__/ring_formater.cpython-312.pyc
Normal file
Binary file not shown.
@ -38,7 +38,7 @@ SPICIES = {
|
||||
"P.pip.",
|
||||
"P.pip",
|
||||
"PPIP",
|
||||
"P.p.",
|
||||
"P.p."
|
||||
"ppip",
|
||||
"Pipistrellus pipistrellus",
|
||||
],
|
||||
@ -180,7 +180,7 @@ SPICIES = {
|
||||
"unbekannt",
|
||||
"unb.",
|
||||
"Unbestimmt",
|
||||
"Mspecbech",
|
||||
"Mspecbech"
|
||||
],
|
||||
"Malc": [
|
||||
"M.alc.",
|
||||
@ -256,7 +256,7 @@ SPICIES = {
|
||||
"MMYO",
|
||||
"mmyo",
|
||||
"Myotis Myotis",
|
||||
"Mspec.bech",
|
||||
"Mspec.bech"
|
||||
"M.m.",
|
||||
"M.m",
|
||||
"MM",
|
||||
@ -310,18 +310,18 @@ CATCHED_BY = [
|
||||
AGE = {
|
||||
"j": [
|
||||
"j",
|
||||
"juv",
|
||||
"juv"
|
||||
],
|
||||
"sub": [
|
||||
"sub",
|
||||
"subad",
|
||||
"sub ad",
|
||||
"sub ad"
|
||||
"sub adult",
|
||||
"sub-adult",
|
||||
"sub-adult"
|
||||
],
|
||||
"a": [
|
||||
"a",
|
||||
"ad",
|
||||
"ad"
|
||||
]
|
||||
}
|
||||
|
||||
@ -329,15 +329,15 @@ REPRODUCTION = {
|
||||
"p": [
|
||||
"plak",
|
||||
"pl",
|
||||
"p",
|
||||
"p"
|
||||
],
|
||||
"g": [
|
||||
"g",
|
||||
"g"
|
||||
],
|
||||
"z": [
|
||||
"lak",
|
||||
"l",
|
||||
"z",
|
||||
"z"
|
||||
]
|
||||
}
|
||||
|
||||
@ -24,10 +24,12 @@ COL_INSTRUCTIONS = {
|
||||
{
|
||||
"command": "FIND_AND_REPLACE",
|
||||
"map": REPRODUCTION,
|
||||
"reqire_full_match": True
|
||||
},
|
||||
{
|
||||
"command": "FIND_AND_REPLACE",
|
||||
"map": AGE,
|
||||
"reqire_full_match": True
|
||||
},
|
||||
{
|
||||
"command": "REGEX_MOVE_TO_COL",
|
||||
@ -56,8 +58,7 @@ COL_INSTRUCTIONS = {
|
||||
},
|
||||
("Art",): {
|
||||
"command": "FIND_AND_REPLACE",
|
||||
"map": SPICIES,
|
||||
"reqire_full_match": True
|
||||
"map": SPICIES
|
||||
},
|
||||
("Ort",): {
|
||||
"command": "REGEX_MOVE_TO_COL",
|
||||
Binary file not shown.
23
run.sh
23
run.sh
@ -2,6 +2,25 @@
|
||||
|
||||
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
|
||||
export PYTHONPATH=$SCRIPT_DIR:$PYTHONPATH
|
||||
$SCRIPT_DIR/.venv/bin/python3 -m fledermaus_formatter "${ABS_ARGS[@]}"
|
||||
$SCRIPT_DIR/.venv/bin/python3 __init__.py "${ABS_ARGS[@]}"
|
||||
BIN
table_handler/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
table_handler/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
table_handler/__pycache__/serializer.cpython-312.pyc
Normal file
BIN
table_handler/__pycache__/serializer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
table_handler/commands/__pycache__/copy.cpython-312.pyc
Normal file
BIN
table_handler/commands/__pycache__/copy.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -9,11 +9,11 @@ class FindAndReplace:
|
||||
def execute_on_cell(self, entry) -> str:
|
||||
res = deepcopy(entry.value)
|
||||
|
||||
for correct_name, bad_names in self.map.items():
|
||||
for bad_name in bad_names:
|
||||
if self.require_full_match and bad_name == res:
|
||||
for species, alternatives in self.map.items():
|
||||
for old_version in alternatives:
|
||||
if self.require_full_match and old_version == res:
|
||||
# Todo remove random leading/trailing spaces before if
|
||||
res = correct_name
|
||||
res = species
|
||||
elif not self.require_full_match:
|
||||
res = res.replace(bad_name, correct_name)
|
||||
res = res.replace(old_version, species)
|
||||
return res
|
||||
BIN
table_handler/conditions/__pycache__/regex_cell.cpython-312.pyc
Normal file
BIN
table_handler/conditions/__pycache__/regex_cell.cpython-312.pyc
Normal file
Binary file not shown.
@ -3,7 +3,7 @@ from openpyxl import Workbook, load_workbook
|
||||
from dataclasses import dataclass
|
||||
from pprint import pprint as print
|
||||
|
||||
import fledermaus_formatter.instructions.mappings as mappings
|
||||
import 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 fledermaus_formatter.logger import logger
|
||||
from logger import logger
|
||||
|
||||
from .conditions.regex_cell import RegexCellCondition
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user