Skip to content

Commit

Permalink
publish
Browse files Browse the repository at this point in the history
  • Loading branch information
e3rd committed Mar 11, 2024
1 parent 180c3c5 commit a20c353
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/run-unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", 3.11, 3.12]
# python-version: [3.11, 3.12] TODO
python-version: [3.12]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
3 changes: 3 additions & 0 deletions deduplidog/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .deduplidog import Deduplidog

__all__ = ["Deduplidog"]
3 changes: 2 additions & 1 deletion deduplidog/deduplidog.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Deduplidog:
debug: bool = None
fail_on_error: bool = False
shorter_log: bool = True
"If True, common prefix of the file names are not output to the log to save space."
"TODO deprecated If True, common prefix of the file names are not output to the log to save space."
logging_level: int = logging.WARNING

ending_counter = re.compile(r"\(\d+\)$")
Expand Down Expand Up @@ -160,6 +160,7 @@ def __post_init__(self):
"Original files, grouped by stem"

self._common_prefix_length = 0
" TODO deprecated"

# Distinguish paths
for a, b in zip(Path(self.work_dir).parts, Path(self.original_dir).parts):
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "deduplidog"
version = "0.5.0"
description = "Deduplicate folders"
authors = ["Edvard Rejthar <edvard.rejthar@nic.cz>"]
Expand All @@ -12,7 +13,9 @@ license = "GPL-3.0-or-later"
python = ">=3.11"
humanize = "*"
imagehash = "*"
IPython = "*"
ipywidgets = "*"
opencv-python = "*"
PIL = "*"
Pillow = "*"
sh = "*"
tqdm = "*"
10 changes: 4 additions & 6 deletions tests.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@

from dataclasses import dataclass
from datetime import datetime
from itertools import chain
import logging
import os
from pathlib import Path
from tempfile import TemporaryDirectory, mkdtemp
from tempfile import TemporaryDirectory
from typing import Self
from unittest import TestCase, main
import random
import string

from deduplidog.deduplidog import Deduplidog # TODO: change to from deduplidog import Deduplidog
from deduplidog import Deduplidog


@dataclass
Expand All @@ -22,7 +20,7 @@ class FileRepresentation:
text_seed: int = 1

def __post_init__(self):
self._mtime = self.path.parent.stat().st_mtime + self.mtime
self._mtime = round(self.path.parent.parent.stat().st_mtime + self.mtime)

def write(self):
"Writes the representation to the disk."
Expand Down Expand Up @@ -76,7 +74,7 @@ def check(self, prefixed: tuple[int] = None, suck: tuple[int] = None):
class TestDeduplidog(TestCase):

def prepare(self, testing_dir: str = None):
temp = Path(testing_dir) if testing_dir else Path(mkdtemp()) # TODO: TemporaryDirectory()
temp = Path(testing_dir) if testing_dir else TemporaryDirectory().name
originals = Path(temp, "originals")
work_dir = Path(temp, "work_dir")
if not testing_dir:
Expand Down

0 comments on commit a20c353

Please sign in to comment.