Skip to content

Commit

Permalink
reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
Elias authored and Elias committed Feb 22, 2024
1 parent 7e02a5a commit 391166c
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 15 deletions.
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cx_Freeze build not successful

import sys
from cx_Freeze import setup, Executable
from src.rosinenpicker.start import __version__
Expand All @@ -15,6 +17,6 @@
version=__version__,
description="A package for picking the juciest text morsels out of a pile of documents.",
options={"build_exe": build_exe_options},
executables=[Executable("src/rosinenpicker/start.py", base=base)],
executables=[Executable("src/rosinenpicker/start.py", base=base, target_name="rosinenpicker")],
)

5 changes: 5 additions & 0 deletions src/rosinenpicker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os
import site

BASE_PATH = os.path.dirname(os.path.abspath(__file__))
site.addsitedir(BASE_PATH)
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pydantic import BaseModel, DirectoryPath, field_validator, model_validator, NewPath
from .patterns import Pattern
from processing.patterns import Pattern
from typing import Optional

class ConfigError(Exception):
Expand Down
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pdfminer.high_level import extract_text
from docx import Document
import re
from .patterns import Pattern
from processing.patterns import Pattern

class DocumentProcessor:
text: str
Expand Down
26 changes: 14 additions & 12 deletions src/rosinenpicker/start.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
__version__ = '0.1.13'
__version__ = '0.1.14'
# see content of __init__.py
import os
import sys
import yaml
import re
import os
import shutil as sh
import pathlib as pl
import pandas as pd
from .pydantic_models import Config, ConfigStrategy, ConfigError
from .database import Base, DbRun, DbStrategy, DbProcessedFile, DbMatch
from .utils import file_sha256
from .exporter import BaseExporter, CSVExporter, XLSXExporter, HTMLExporter, JSONExporter
from .processors import DocumentProcessor, PDFProcessor, TXTProcessor, DOCXProcessor
from data.pydantic_models import Config, ConfigStrategy, ConfigError
from data.database import Base, DbRun, DbStrategy, DbProcessedFile, DbMatch
from utils.utils import file_sha256
from processing.exporter import BaseExporter, CSVExporter, XLSXExporter, HTMLExporter, JSONExporter
from processing.processors import DocumentProcessor, PDFProcessor, TXTProcessor, DOCXProcessor
from sqlalchemy import create_engine, select
from sqlalchemy.orm import sessionmaker, Session
import argparse
Expand Down Expand Up @@ -137,7 +139,7 @@ def cli():
# version?
if args.version:
print(f"{__version__}")
exit(0)
sys.exit(0)

# read out only?
if args.readout:
Expand All @@ -147,24 +149,24 @@ def cli():
# file format implemented?
if fe not in file_format_options.keys():
print(f"File '{args.readout}' appears to be of a type that cannot be read out!")
exit(1)
sys.exit(1)
# determine processor
processor = file_format_options[fe]
# print out
pr = processor(args.readout) # second argument inconsequential, to be removed at a later point
print(pr.text)
# exit
exit(0)
sys.exit(0)
else:
print("No file to read out provided!")
parser.print_help()
exit(1)
sys.exit(1)

# check if config exists!
if not os.path.isfile(args.config):
print("No configuration file provided! Please add one using -c! Apply -h for help.\n")
parser.print_help()
exit(1)
sys.exit(1)

main(args.config, args.database)

Expand Down
Empty file.
File renamed without changes.

0 comments on commit 391166c

Please sign in to comment.