Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
256 commits
Select commit Hold shift + click to select a range
6ecb2bd
Unify remove modules and implement validation for non-check modules
MelvinFrederiks Apr 13, 2026
9cda943
Remove some unused code in demeuk.py
MelvinFrederiks Apr 13, 2026
34cc78e
Updated some modify modules
MelvinFrederiks Apr 13, 2026
121f4b4
Updated some more modules
MelvinFrederiks Apr 13, 2026
52b9d95
Some comments and cleanup
MelvinFrederiks Apr 13, 2026
914cb31
Remove duplicated code
MelvinFrederiks Apr 13, 2026
3863145
Removed more unused code
MelvinFrederiks Apr 13, 2026
257ebe8
Implemented most modules. Still some weirdness with encoding
MelvinFrederiks Apr 13, 2026
4a44177
Fixed clean_encode, mixed up variables
MelvinFrederiks Apr 13, 2026
cc69643
Removed leftover simple config checks
MelvinFrederiks Apr 13, 2026
837d69f
Updated more configs to argparse
MelvinFrederiks Apr 14, 2026
5c2f017
Update tests to new dir structure and python version
MelvinFrederiks Apr 14, 2026
6ffa811
Added leak and leak-full
MelvinFrederiks Apr 14, 2026
c047376
Removed old code
MelvinFrederiks Apr 14, 2026
f605fc8
Added arguments and changed path in test_app
MelvinFrederiks Apr 14, 2026
d33e706
Added flag_collection dict for leak, leak-full, googlengram
MelvinFrederiks Apr 14, 2026
f52950e
Re-enabled cut, small changes
MelvinFrederiks Apr 14, 2026
15ec063
Fix typo
MelvinFrederiks Apr 14, 2026
3475a08
fixed delimiter config not getting saved
MelvinFrederiks Apr 14, 2026
39c27b7
updated other globals to use getters and setters
MelvinFrederiks Apr 15, 2026
a285ce9
Clean debug messages
MelvinFrederiks Apr 15, 2026
2c3e4e4
Updated email test for ordered arguments
MelvinFrederiks Apr 15, 2026
42f8cd1
Fixed incorrect leak-full string
MelvinFrederiks Apr 15, 2026
e38e223
Fixed hash regex
MelvinFrederiks Apr 15, 2026
10ecc86
bcrypt hash fix
MelvinFrederiks Apr 15, 2026
a2256f1
Fix --encode
MelvinFrederiks Apr 15, 2026
456c78a
Cleaned up debug statements
MelvinFrederiks Apr 15, 2026
458fd6a
actually use verbose flag in stderr_print
MelvinFrederiks Apr 15, 2026
e770db5
Linked --cut and -c
MelvinFrederiks Apr 15, 2026
78cb494
Removed f-strings where not needed
MelvinFrederiks Apr 15, 2026
73ea701
Added fixed part of function pipeline
MelvinFrederiks Apr 15, 2026
f32a817
Get rid of old config object
MelvinFrederiks Apr 15, 2026
9f0f3a1
Cleaned up comments and unused imports
MelvinFrederiks Apr 15, 2026
05f6e8d
Moved cut from fixed to normal pipeline
MelvinFrederiks Apr 15, 2026
0a55089
Updated test, ordered arguments
MelvinFrederiks Apr 15, 2026
d26526b
Fix unhex test using explicit input encoding
MelvinFrederiks Apr 15, 2026
8065d65
Fix formatting for flake
MelvinFrederiks Apr 15, 2026
7de54e2
Matched delimiter code for splitting on commas
MelvinFrederiks Apr 15, 2026
1191a65
Remove unused variables
MelvinFrederiks Apr 15, 2026
5dcd7e7
Move help messages to argparse, pt1
MelvinFrederiks Apr 15, 2026
2f9f95e
Update arg help msgs
MelvinFrederiks Apr 15, 2026
3f99b3b
Moveddocstring with help to parser
MelvinFrederiks Apr 16, 2026
e3b9240
Move googlengram debug string to module
MelvinFrederiks Apr 16, 2026
1cbf473
Actually get googlengram msg
MelvinFrederiks Apr 16, 2026
0fc0abd
Fixed wrong escaped charaters in help msg
MelvinFrederiks Apr 16, 2026
245c02a
move config variables to top of file
MelvinFrederiks Apr 16, 2026
d6beda5
fix flake warnings
MelvinFrederiks Apr 16, 2026
eced60d
Cleaned up comments
MelvinFrederiks Apr 16, 2026
06d4a6a
Fix --newline help msg
MelvinFrederiks Apr 16, 2026
c0c90ae
Flake fixes
MelvinFrederiks Apr 16, 2026
1c89c3e
Bump version
MelvinFrederiks Apr 16, 2026
3909e81
--hex and --html are part of fixed pipeline, so we can remove their m…
MelvinFrederiks Apr 16, 2026
d6da1a1
Clean up setting options with defaults
MelvinFrederiks Apr 16, 2026
7ad0133
Comments and style
MelvinFrederiks Apr 16, 2026
72306fa
converted double quote-strings to single quotes
MelvinFrederiks Apr 16, 2026
529328d
Style, comments, typos
MelvinFrederiks Apr 16, 2026
6913805
updated examples to actually run in the command line
MelvinFrederiks Apr 16, 2026
d1662bb
Clean validate error msgs
MelvinFrederiks Apr 16, 2026
153a15d
removed hardcoded fixed-pipeline functions
MelvinFrederiks Apr 16, 2026
dd8f424
Cleaned up validate.py repeating code blocks
MelvinFrederiks Apr 17, 2026
78d53f7
Combined validate_output for check and other modules
MelvinFrederiks Apr 17, 2026
dde27b4
Cleaned up import statements
MelvinFrederiks Apr 17, 2026
bef3a5b
Python 3.8 compatibility
MelvinFrederiks Apr 17, 2026
fcf424a
Updated package structure to more standard form
MelvinFrederiks Apr 20, 2026
653ad94
Small optimizations inside the clean_up main loop
MelvinFrederiks Apr 20, 2026
634708c
Separated modules into directory
MelvinFrederiks Apr 20, 2026
63f7855
Pass type info instead of option name to clean_up
MelvinFrederiks Apr 21, 2026
11b4145
Flipped check module output, now return True if something happened
MelvinFrederiks Apr 21, 2026
32b1573
Migrated to pyproject.toml and pdm-based build system.
MelvinFrederiks Apr 21, 2026
ebd7899
Removed setup.py and requirements.txt
MelvinFrederiks Apr 21, 2026
132bb53
Added support for ruff
MelvinFrederiks Apr 21, 2026
b3b6717
optimized imports and minor style fixes
MelvinFrederiks Apr 21, 2026
beb1c8f
Updated ruff rules
MelvinFrederiks Apr 21, 2026
8a2409a
Style fixes
MelvinFrederiks Apr 21, 2026
1cd3776
Removed tox.ini
MelvinFrederiks Apr 21, 2026
51eccdc
Fixed formatting rules
MelvinFrederiks Apr 23, 2026
3238272
Actually don't care for python 3.8 support
MelvinFrederiks Apr 23, 2026
70ca976
Clean up comments
MelvinFrederiks Apr 23, 2026
2b5c92b
small optimization in check_hash
MelvinFrederiks Apr 23, 2026
790e557
Added back testing differrent python versions with tox
MelvinFrederiks Apr 23, 2026
81f58b9
Updated lock file for correct groups and python versions
MelvinFrederiks Apr 23, 2026
159ec5d
Updated Github Action to pdm
MelvinFrederiks Apr 23, 2026
c127d80
Added back missing debug message and cleaned up imports
MelvinFrederiks Apr 23, 2026
f6df124
Cleaned up some comments
MelvinFrederiks Apr 23, 2026
0d9cb8e
Updated README
MelvinFrederiks Apr 23, 2026
0365c03
Added test dependencies to lock file
MelvinFrederiks Apr 23, 2026
7983fc8
Updated documentation, started a guide on how to add new modules
MelvinFrederiks Apr 23, 2026
4a17392
Started frame for refactoring
MelvinFrederiks Apr 28, 2026
a60f594
Added Pipeline.run functionality
MelvinFrederiks Apr 29, 2026
8087f9d
Added better logging interface, and some more standard modules to test
MelvinFrederiks Apr 29, 2026
2794a13
Added --encode module, not functional yet
MelvinFrederiks Apr 29, 2026
b1f7745
Added --encode module (and default)
MelvinFrederiks Apr 30, 2026
1a757bd
Added framework for macro modules
MelvinFrederiks Apr 30, 2026
1b370ee
Moved modules to right position, and rename Result.debug_str to msg
MelvinFrederiks Apr 30, 2026
ec65992
Implemented --leak
MelvinFrederiks Apr 30, 2026
ae6f847
pdm now detects version automatically
MelvinFrederiks Apr 30, 2026
825b72c
Added autodiscovery for modules
MelvinFrederiks Apr 30, 2026
39cc66b
Fixed f-strings for python <3.12
MelvinFrederiks Apr 30, 2026
f7426ca
Added run message to logs
MelvinFrederiks Apr 30, 2026
61da04d
Ported over multiprocessing code
MelvinFrederiks Apr 30, 2026
6746963
Added better job handling
MelvinFrederiks Apr 30, 2026
795b0f7
Don't read file twice
MelvinFrederiks Apr 30, 2026
b75a1cd
Updated packages
MelvinFrederiks Apr 30, 2026
0ca8ff2
Removed test msg
MelvinFrederiks Apr 30, 2026
5c0e2fe
Run pytest with -s, weird bug prevents pickling from pytest environme…
MelvinFrederiks Apr 30, 2026
c9d2c42
Ported --googlengram
MelvinFrederiks May 1, 2026
c20eae7
Remove get_parser_group, determine -h grouping by class type
MelvinFrederiks May 1, 2026
bc0dc3c
Fixed comments
MelvinFrederiks May 1, 2026
220b645
Better debug_str handling
MelvinFrederiks May 1, 2026
5e4ab62
Module discovery now looks recursively inside subdirectories
MelvinFrederiks May 1, 2026
1a9c01b
Moved around modules into new directory structure
MelvinFrederiks May 1, 2026
5325835
Sort command-line options
MelvinFrederiks May 1, 2026
32a3973
Moved leak module
MelvinFrederiks May 1, 2026
00b0c85
Added default debug str for modify module
MelvinFrederiks May 1, 2026
ab25355
Moved Hex module and added html modules
MelvinFrederiks May 1, 2026
436e509
Removed debug print
MelvinFrederiks May 1, 2026
625d8ba
Removed old modules
MelvinFrederiks May 1, 2026
7136839
Moved googlengram to own file
MelvinFrederiks May 1, 2026
053adfe
Implemented check modules which look for a regex
MelvinFrederiks May 1, 2026
8fb87c0
Added shortcut results for check modules
MelvinFrederiks May 1, 2026
639d096
Fixed regex module not having correct helpinfo
MelvinFrederiks May 1, 2026
f9bec27
Fix imports and typo in leak.py
MelvinFrederiks May 1, 2026
dbbc5b6
Use shortcuts in check modules
MelvinFrederiks May 1, 2026
842a5e7
Added some more check modules
MelvinFrederiks May 1, 2026
1be62a6
Remove debug pipeline print
MelvinFrederiks May 1, 2026
39e016b
Added leak-full for real
MelvinFrederiks May 1, 2026
d3652cc
Added support for -n/--limit
MelvinFrederiks May 1, 2026
fb8bbb7
Set param type correctly, and use encapsulation
MelvinFrederiks May 1, 2026
d3faaae
Add bounds-check modules
MelvinFrederiks May 1, 2026
f6420b8
Fix typo in bounds.py
MelvinFrederiks May 1, 2026
db439b1
Ported lower/titlecase modules
MelvinFrederiks May 4, 2026
004c1fd
Implemented cut module
MelvinFrederiks May 4, 2026
f44aac6
Implemented correct delimiter parsing
MelvinFrederiks May 4, 2026
c2dba99
Added abstract RemoveModule and ported remove modules
MelvinFrederiks May 4, 2026
9e6a164
Moved implemented check modules to own files
MelvinFrederiks May 4, 2026
a33b00e
Implemented and reorganized remaining modify modules.
MelvinFrederiks May 4, 2026
f6b0305
Implemented more add modules
MelvinFrederiks May 4, 2026
b9bc075
Implemented umlaut modules
MelvinFrederiks May 4, 2026
e51dd78
Added latin-ligatures add module
MelvinFrederiks May 4, 2026
40a947e
Removed already implemented modules
MelvinFrederiks May 4, 2026
b867c9d
Added min/max length modules
MelvinFrederiks May 4, 2026
c691b52
Added min/max length modules
MelvinFrederiks May 4, 2026
b1fbe1d
Added check modules checking substrings
MelvinFrederiks May 4, 2026
cd073c4
Added check-case module
MelvinFrederiks May 4, 2026
74f8389
Add check-non-ascii module
MelvinFrederiks May 4, 2026
cf7a291
Fixed test_verbose, new logging messages
MelvinFrederiks May 4, 2026
c100638
Actually fix test_verbose
MelvinFrederiks May 4, 2026
60a0676
Demeuk multiple files
MelvinFrederiks May 4, 2026
1f40614
Missing space in default config for punctuation
MelvinFrederiks May 4, 2026
be023d6
Use system locale/encoding when writing to file
MelvinFrederiks May 4, 2026
979a98a
Set correct output encoding
MelvinFrederiks May 4, 2026
f9c08e8
Closed out/log files when done
MelvinFrederiks May 4, 2026
699c0f8
Added main encapsulation, for moving to a more simple approach where …
MelvinFrederiks May 4, 2026
e8bc79d
allow test to use modular design
MelvinFrederiks May 4, 2026
3617d2d
Fixed argument encapsulation
MelvinFrederiks May 4, 2026
251dd4c
Fixed incorrect arg names
MelvinFrederiks May 4, 2026
3e22487
Fixed test_demeuk because added pipeline log
MelvinFrederiks May 4, 2026
f368adc
Implemented stdin
MelvinFrederiks May 4, 2026
427c0a5
Reordered --leak-full to clean newlines before controlchar
MelvinFrederiks May 4, 2026
a7d2763
Set encoding settings before opening files
MelvinFrederiks May 4, 2026
9aced1a
Updated _run_demeuk such that it uses the same file format as the oth…
MelvinFrederiks May 4, 2026
6c237e0
Patched some state-dependent tests
MelvinFrederiks May 4, 2026
4268d38
fixed test_check_contains whitespace
MelvinFrederiks May 4, 2026
92226be
-i can now take glob or multipla input files
MelvinFrederiks May 6, 2026
2f4d612
Split file/stdin functionality
MelvinFrederiks May 6, 2026
080edbb
Read from stdin when not supplying -i
MelvinFrederiks May 6, 2026
7c21429
Fixed glob test
MelvinFrederiks May 6, 2026
a65b6ec
Pass logger instead of config to check_finished_jobs
MelvinFrederiks May 6, 2026
36cf856
Close files after demeuking
MelvinFrederiks May 6, 2026
c5dceb8
Remove input-file access check, as we already do it in config ctor
MelvinFrederiks May 6, 2026
c8185ab
Fix bug where output file was written before thread was done
MelvinFrederiks May 6, 2026
2ccfe28
Fix output file writing
MelvinFrederiks May 6, 2026
c628878
Temporarily disable saving results and logs as variables
MelvinFrederiks May 6, 2026
5adcd11
Removed reference to demeuk2 and parser2
MelvinFrederiks May 6, 2026
c5061ec
Cleaned CLI entry point naming
MelvinFrederiks May 7, 2026
9452eea
Use control flow instead of stop variable
MelvinFrederiks May 7, 2026
5d0cab0
Update test_app with new function names
MelvinFrederiks May 7, 2026
e880f27
Use os-independent linesep instead of \n
MelvinFrederiks May 7, 2026
7eff1ae
Use one Result object instead of creating new ones for every iteration
MelvinFrederiks May 7, 2026
5a4a816
Also used result_next in add.py
MelvinFrederiks May 7, 2026
d195055
Added debug single-threaded mode
MelvinFrederiks May 7, 2026
9f4e1da
For testing, just read output file
MelvinFrederiks May 7, 2026
56cd652
Don't return results/logs for now, simply operate on files
MelvinFrederiks May 7, 2026
0645aa4
Correctly check if list is not None
MelvinFrederiks May 7, 2026
c5a8cfb
Create log file if it does not exist
MelvinFrederiks May 7, 2026
98c212c
Remove validate.py
MelvinFrederiks May 7, 2026
0ae256b
Assume we can run demeuk as a command
MelvinFrederiks May 7, 2026
391a711
allow tox to pass args to pytest
MelvinFrederiks May 7, 2026
ab79db2
Don't write to file early to prevent multiple processes writing to sa…
MelvinFrederiks May 7, 2026
c072aaf
Fixed test_glob
MelvinFrederiks May 7, 2026
430190b
Wait longer before getting job result
MelvinFrederiks May 7, 2026
078e3bb
Change Parser to CommandLineParser, and update some outdated comments
MelvinFrederiks May 7, 2026
9b9d698
Port os.path to pathlib
MelvinFrederiks May 7, 2026
120aa40
remove comments
MelvinFrederiks May 7, 2026
981a38e
Added some explanatory comments
MelvinFrederiks May 7, 2026
51ef839
Updated README, don't need PDM to run after installing with pipx
MelvinFrederiks May 7, 2026
3ba7248
Added modules to __init__.py for easier import
MelvinFrederiks May 7, 2026
e39f279
Path.walk requires python 3.12
MelvinFrederiks May 11, 2026
d968d25
Renamed result_next to reflect that it is a constant
MelvinFrederiks May 11, 2026
414c5a2
Rename chunk to multiproc
MelvinFrederiks May 11, 2026
f730de9
improved module discovery and add docstring
MelvinFrederiks May 11, 2026
27eb76d
Fix docstring pos
MelvinFrederiks May 11, 2026
12e7244
Docstrings for multiproc.py
MelvinFrederiks May 11, 2026
76cf054
Docstrings for demeuk.py
MelvinFrederiks May 11, 2026
4d109d1
Split logging facilities and output file handling
MelvinFrederiks May 11, 2026
21cde12
Don't need multiple logger functionality
MelvinFrederiks May 11, 2026
3b04e04
Added documentation to non-module files
MelvinFrederiks May 11, 2026
3086cf0
Added some docstrings in base.py
MelvinFrederiks May 11, 2026
436e27c
Add docstrings in base.py
MelvinFrederiks May 12, 2026
b3e05d0
Added docstrings for the base modules
MelvinFrederiks May 12, 2026
7bf2b55
Fix unknown pytest mark warning
MelvinFrederiks May 12, 2026
567ef3e
Remove one line from text_unhex, which failed tests due to chardet up…
MelvinFrederiks May 12, 2026
64aed95
Test ordering of modules
MelvinFrederiks May 12, 2026
53e02d2
Fixed doc, chunks are 1 MB instead of 1 kB
MelvinFrederiks May 12, 2026
c8ab77d
Updated info in design docs
MelvinFrederiks May 12, 2026
9d91fb1
Fixed sphinx build configs
MelvinFrederiks May 12, 2026
15770a8
Add back the self.next property in check modules, now containing a re…
MelvinFrederiks May 12, 2026
d05bdc4
New module docs
MelvinFrederiks May 12, 2026
7610b56
Update readme/install docs
MelvinFrederiks May 12, 2026
abfbe19
Updated docstrings in demeuk.py to sphinx format
MelvinFrederiks May 12, 2026
e331166
correct pipx url
MelvinFrederiks May 12, 2026
269a957
Change pdm to pipx in docs
MelvinFrederiks May 12, 2026
f7467bd
Some comments on docs
MelvinFrederiks May 12, 2026
501f329
Test py3.12 and up
MelvinFrederiks May 12, 2026
e7d2915
Style fixes
MelvinFrederiks May 13, 2026
4cd57e7
Updated API ref
MelvinFrederiks May 13, 2026
bd67195
Updated design and new_module docs
MelvinFrederiks May 13, 2026
3ebb82a
Moved details on Results and Actions to design doc
MelvinFrederiks May 13, 2026
ec87033
Fix imports and tests with pdm
MelvinFrederiks May 13, 2026
6c3f5d9
Updated readme usage examples
MelvinFrederiks May 13, 2026
c3a0198
Remove notes on tests
MelvinFrederiks May 13, 2026
cd46ed3
Don't use relative path to discover modules
MelvinFrederiks May 13, 2026
5004506
Update pdm lock file
MelvinFrederiks May 13, 2026
0381cd3
Add some comments in pipeline.py
MelvinFrederiks May 13, 2026
cc59d3d
Update GH workflow
MelvinFrederiks May 13, 2026
7f2ac46
Fix heading in docs
MelvinFrederiks May 13, 2026
9ab6e4d
Use parser group enum instead of string keys
MelvinFrederiks May 13, 2026
341e350
Add example with pipes to readme
MelvinFrederiks May 13, 2026
8fe815a
Some testing with file IO, wrote down notes
MelvinFrederiks May 13, 2026
9b61428
Fix incorrect writes to output file
MelvinFrederiks May 15, 2026
4569926
Check for finished jobs before submitting new job
MelvinFrederiks May 15, 2026
7962f84
Use RTD theme for sphinx
MelvinFrederiks May 15, 2026
65d40dd
Updated comments
MelvinFrederiks May 15, 2026
0f084b7
Added alternative install instructions
MelvinFrederiks May 15, 2026
0ea9377
Updated README
MelvinFrederiks May 15, 2026
2e3abc8
Update README with PDM install instructions
MelvinFrederiks Jul 15, 2026
f36025e
Fix merge conflict
MelvinFrederiks Jul 15, 2026
c2fd5a3
Set +x in CI, and use pdm to run test
MelvinFrederiks Jul 15, 2026
c834ba5
Only have one test job for all supported versions at once with tox
MelvinFrederiks Jul 15, 2026
8f5a3a2
Only publish if pushed on master
MelvinFrederiks Jul 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 14 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,31 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
uses: pdm-project/setup-pdm@v4
- name: Install dependencies
run: |
set +x
python -m pip install --upgrade pip
pip install tox
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pdm install -G test
- name: Run tests
run: |
tox
pdm run test
publish:
runs-on: ubuntu-latest
needs: test
# Only publish on master
if: github.ref == 'refs/heads/master'
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install publishing dependencies
if: github.ref == 'refs/heads/master'
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Install package dependencies
if: github.ref == 'refs/heads/master'
run: |
python -m pip install -r requirements.txt
- name: Build and publish
if: github.ref == 'refs/heads/master'
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
- name: Publish wheel
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
PDM_PUBLISH_USERNAME: __token__
PDM_PUBLISH_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: pdm publish
40 changes: 26 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,40 @@ grant agreement No. 82201
Please read the docs for more information.

## Quick start
The recommended way to install demeuk is to install it in a virtual
environment.
Demeuk supports Python versions 3.12 and up.
The recommended way to install demeuk is to use [pipx](https://pipx.pypa.io/stable/).

```
# Create virtual environment
virtualenv <virtual environment name>
# Activate the virtual environment
source <virtual environment name>/bin/activate
pip3 install -r requirements.txt
pipx install demeuk --python /usr/bin/python3.14
```

Now you can run bin/demeuk.py:
Now you can invoke demeuk directly from the command-line from any directory:

Examples:
```
demeuk -i inputfile.tmp -o outputfile.dict -l droppedfile.txt
demeuk -i inputfile -o outputfile -j 24 -l logfile.log
demeuk -i inputfile.tmp -o outputfile.dict -l droppedfile.txt --leak
demeuk -i inputfile -o outputfile -j 24 -l logfile.log --leak-full
demeuk -i inputdir/*.txt -o outputfile.dict -l logfile.log
demeuk -o outputfile.dict -l logfile.log
demeuk -i inputfile.tmp -o outputfile.dict -l demeuk.log
demeuk -i inputfile -o outputfile -j 24 -l demeuk.log
demeuk -i inputfile.tmp -o outputfile.dict -l demeuk.log --leak
demeuk -i inputfile -o outputfile -j all -l demeuk.log --leak-full
demeuk -i inputdir/*.txt -o outputfile.dict -l demeuk.log
```
Demeuk also works with pipes:
```
cat wordlist | demeuk --leak-full --debug > list.out 2> list.log
```

## Development
To make changes to demeuk, you need to run it from the source Python files.
```
git clone https://github.com/NetherlandsForensicInstitute/demeuk.git
cd demeuk
pipx install ./ --python /usr/bin/python3.14
```
Now you can run demeuk as in the examples. Note that the shortcut `demeuk` only updates after you
run `pipx upgrade demeuk`.

You can install demeuk through PDM with `pdm install -p ./`, this circumvents this issue although you have to
run demeuk with `pdm run demeuk`.

## Docs
The docs are available at: <http://demeuk.rtfd.io/>
1,851 changes: 0 additions & 1,851 deletions bin/demeuk.py

This file was deleted.

50 changes: 47 additions & 3 deletions docs/api_ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,53 @@ API Reference

This chapter is for developers of demeuk, it contains the API functions.

Demeuk-api
==========
.. automodule:: bin.demeuk
demeuk
------
.. automodule:: demeuk.demeuk
:members:
:undoc-members:
:show-inheritance:


modules.base
------------
.. automodule:: demeuk.modules.base
:members:
:undoc-members:
:show-inheritance:

modules.add
-----------
.. automodule:: demeuk.modules.add.add
:members:
:undoc-members:
:show-inheritance:

modules.check
-------------
.. automodule:: demeuk.modules.check.check
:members:
:undoc-members:
:show-inheritance:

modules.modify
--------------
.. automodule:: demeuk.modules.modify.modify
:members:
:undoc-members:
:show-inheritance:

modules.remove
--------------
.. automodule:: demeuk.modules.remove.remove
:members:
:undoc-members:
:show-inheritance:

modules.macro
--------------
.. automodule:: demeuk.modules.macro.macro
:members:
:undoc-members:
:show-inheritance:

10 changes: 6 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
import os
import sys

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('../src'))
source_suffix = ['.rst', '.md']

from bin.demeuk import version # noqa: E402
from demeuk.demeuk import get_version

# -- Project information -----------------------------------------------------

project = 'demeuk'
copyright = '2019 - 2021, NFI'
copyright = '2019 - 2026, NFI'
author = 'Netherlands Forensic Institute (NFI)'

# The full version, including alpha/beta/rc tags
release = version
release = get_version()


# -- General configuration ---------------------------------------------------
Expand All @@ -47,6 +47,8 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# Use the same ordering as the source file for members.
autodoc_member_order = 'bysource'

# -- Options for HTML output -------------------------------------------------

Expand Down
137 changes: 82 additions & 55 deletions docs/design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,107 @@ some insight on how the application works. Mostly it is useful in case you
are working with a bug or don't understand why something is happening and it
is a must read for anyone adding features to demeuk.

.. _modules:

Modules
-------
Demeuk is a modular program; you can enable functionality by specifying their respective command-line options.
Demeuk supports four different type of modules.

- Modify or Clean modules. Those modules modify something in a line. For example replace tab
character with ':'. The commandline parameters will have the name of the module
without a prefix.
- Add modules. Those modules will modify something in a line, but keep the original
line as well. For example, add a lower case variant of a line. These modules will
have the commandline parameters start with 'add-' prefix.
- Check modules. Those modules will check if a line passes some test. For example
a minimal length check. The commandline parameters start with the 'check-' prefix.
If a line fails the check, the line is dropped.
- Remove modules. Those modules will remove specific parts of a line and does this
in place. For example punctuation needs to be removed, those modules will be used.
The commandline parameters will start with the 'remove-' prefix.

Note that when any add option is used, any other modules (like clean, check, remove
AND even add) will be ran on the modified line again. This might result in creating
an loop if it keeps creating new lines. So be careful with using those options.


There is another class of modules called macro modules. These are modules which invoke a number of
other modules, and may provide other functionality themselves. Examples of macro modules are
``leak`` and ``leak-full``, which are simply a sensible collection of other modules to clean up data leaks.


.. _pipeline:

Pipeline
--------
Demeuk runs its input through a pipeline, which is a linear sequence of modules. The action
of a module on types determines its place in the pipeline.

Input is read as bytes, at some point it is *encoded*, at which point these bytes are treated as a
Python string. At this point we can work with the input as strings of characters. Keeping this in
mind, a module can fall in three classes:

* A module which takes bytes as input and returns a byte sequence,
* A module which takes bytes as input and returns a string (an *encoding* module),
* A module which takes a string as input and returns a string.

A module in the pipeline will return a ``Results`` object, containing a ``status`` field. If this
is set to ``False``, nothing happens and the line is passed to the next module in line. If however
this field is ``True``, the ``Results`` object is passed to ``handle()`` which, depending on the
module type, determines what concrete actions to take. These actions could be: Stop further
processing of the line, add a variant, log a debug message, etc. This is encoded in and ``Actions``
object which is processed by ``Pipeline.run()``.

Threading
---------
In cause of an input file, the file is 'chunked' by the main processes. It will split
the input files in chunks. It does so by reading the file per 1 KB. After reading 1 KB
it will search for the next newline after the 1 KB. It will then read again 1 KB and
the input files in chunks. It does so by reading the file per 1 MB. After reading 1 MB
it will search for the next newline after the 1 MB. It will then read again 1 MB and
search for the first new line after that. This will continue until the end of the file.

The size of 1 KB is used to reduce memory load and was found to be a solid number for
The size of 1 MB is used to reduce memory load and was found to be a solid number for
good performance.

When using stdin, the input is not chunked. This is because stdin is a stream and
thus we can not seek to a specific offset. So the main thread will read the input
per 1 KB and search for the first newline after that.
per 1 MB and search for the first newline after that.

Searching for the next newline is done using the python's splitlines()
Searching for the next newline is done using the python's splitlines()
function. This means the line will be splitted on: line feed, carriage return,
LF + CR, formfeeds, file separator, etc. See https://docs.python.org/3/library/stdtypes.html
for more information.

Next a thread will process the list of lines.

Once all threads are done, the main thread will combine all of the results.
Once all threads are done, the main thread will combine all of the results.
You should note that the order inside the final output will be completely
un ordered and thus if you want to have a sorted list you need to sort it yourself.

A note on the add modules and threading: Lines are dedicated to different
threads based on a configured chunk size. When additional lines are added, all
other modules will run again on the line. The thread that created the new line
will also run those modules again. Meaning that if one thread creates a lot of
different new lines that thread might be busier then other threads. But because
the chunksize is quite small, this will probably not be an issue. If this is an
issue for someone please submit a bug.

Encoding detection
------------------
Next, when '--tab' is enabled all tabs will be converted to ':' greedy. This is to have
a single cut/splitting char. This is done on binary level.

Next, we arrive at one of the most important things of this application. The encoding detecting
enable this with '--encode'. Some dataset are a combination of different sources. This means
One of the most important things of this application is the encoding detection,
enabled with ``--encode``. Some datasets are a combination of different sources. This means
EVERY line can have a different encoding. People or applications tend to make a lot
of errors in encoding, as does this application. Demeuk tries its best to detect
and correct as much as possible, but there will for sure be some weird case where it fails
to do so. By default the application will try to decode the data using UTF-8.

So we start by checking if we have a default encoding to try. This is either
UTF-8 or supplied by the user. If the line decodes and there does not appear to be
control character inside the line we can assume that the detection went correctly.
Note: If you supply a list of input encodings. Put multibyte encodings first.
Because single byte encodings will cause false positives.
UTF-8 or supplied by the user with ``--input-encoding``. If the line decodes and there does not
appear to be control characters inside the line we can assume that the detection went correctly.
Note: If you supply a list of input encodings. Put multibyte encodings first, because single byte
encodings will cause false positives.

If that fails we run the detect function of the chardet library. Note: first the
If that fails we run the detect function of the chardet library. Note: first the
cchardet library was implemented, but this library resulted in too many wrongly
encoded lines. Inside the tests of demeuk there are lot of edge cases which were
found and corrected. So if you change something in the encoding detection
Expand All @@ -58,44 +115,14 @@ please run the tests to verify that you have not broken something.
If it managed detect any encoding, it will try to decode this line. If no unicode
error happens we assume that we got some result.

Next we try to fix mojibakes, for this enable the --mojibake option
basically, we might have decoded the string incorrectly
and now correct some of the common errors. For this we use the FTFY library.

Modules
-------
After a line has been decoded correctly demeuk will start to run all the modules.
Demeuk consist of 4 different type of modules.

- Clean modules. Those modules modify something in a line. For example replace tab
character with ':'. The commandline parameters will have the name of the module
without a prefix.
- Add modules. Those modules will modify something in a line, but keep the original
line aswell. For example, add a lower case variant of a line. These modules will
have the commandline parameters start with 'add-' prefix.
- Check modules. Those modules will check if a line passes some test. For example
a minimal length check. The commandline parameters start with the 'check-' prefix.
If a line fails the check, the line is dropped.
- Remove modules. Those modules will remove specific parts of a line and does this
in place. For example punctuation needs to be removed, those modules will be used.
The commandline parameters will start with the 'remove-' prefix.

The name that a module has on the commandline will mean that the function inside the
source code must also has the exact same name. Only clean module will start with the
'clean\_' prefix to prevent name clashes with default functions.

Note that when any add option is used, any other modules (like clean, check, remove
AND even add) will be ran on the modified line again. This might result in creating
an loop if it keeps creating new lines. So be careful with using those options.
You can enable the ``--mojibake`` option to let demeuk try to fix mojibakes, which are
artifacts of wrong decoding. For this we use the FTFY library.

For now there is no specific order in which the module type will run. Apart from
the add modules, which will always run last. If someone find a specific use case
for which the order needs to be configured; please submit a bug.

Another note on the add modules and threading. Lines are dedicated to different
threads based on a configured chunk size. When additional lines are added, all
other modules will run again on the line. The thread that created the new line
will also run those modules again. Meaning that if one thread creates a lot of
different new lines that thread might be busier then other threads. But because
the chunksize is quite small, this will probably not be an issue. If this is an
issue for someone please submit a bug.
Module ordering
---------------
After successfully figuring out the decoding of the line, there are many different modules which
can be run. All modules which function after the encoding step will be run in the order in which
they are supplied to the program. This enables great flexibility, but it also means you need to
think about this order. If you don't know where to start, put modify modules first, then check
modules, remove modules and finally add modules.
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Table of content
:maxdepth: 3

install
usage
design
new_module
usage
api_ref
Loading
Loading