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