clutterxp 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clutterxp/__init__.py +4 -0
- clutterxp/cli/__init__.py +7 -0
- clutterxp/cli/app.py +251 -0
- clutterxp/cli/cmd_config.py +250 -0
- clutterxp/cli/cmd_doctor.py +449 -0
- clutterxp/cli/cmd_duplicates.py +253 -0
- clutterxp/cli/cmd_gui.py +22 -0
- clutterxp/cli/cmd_history.py +233 -0
- clutterxp/cli/cmd_init.py +76 -0
- clutterxp/cli/cmd_organize.py +226 -0
- clutterxp/cli/cmd_rules.py +540 -0
- clutterxp/cli/cmd_scan.py +109 -0
- clutterxp/cli/cmd_service.py +130 -0
- clutterxp/cli/cmd_undo.py +180 -0
- clutterxp/cli/cmd_watch.py +147 -0
- clutterxp/cli/errors.py +166 -0
- clutterxp/cli/render.py +390 -0
- clutterxp/config/__init__.py +40 -0
- clutterxp/config/jsonschema.py +12 -0
- clutterxp/config/loader.py +212 -0
- clutterxp/config/placeholders.py +79 -0
- clutterxp/config/runtime.py +30 -0
- clutterxp/config/schema.py +166 -0
- clutterxp/config/validate.py +226 -0
- clutterxp/config/writer.py +248 -0
- clutterxp/config.example.yaml +76 -0
- clutterxp/duplicates/__init__.py +22 -0
- clutterxp/duplicates/detector.py +438 -0
- clutterxp/duplicates/hashcache.py +149 -0
- clutterxp/duplicates/namenorm.py +45 -0
- clutterxp/duplicates/quarantine.py +196 -0
- clutterxp/duplicates/report.py +110 -0
- clutterxp/gui/__init__.py +1 -0
- clutterxp/gui/api.py +494 -0
- clutterxp/gui/app.py +205 -0
- clutterxp/gui/models_qt.py +544 -0
- clutterxp/gui/views/__init__.py +21 -0
- clutterxp/gui/views/dashboard.py +253 -0
- clutterxp/gui/views/duplicates.py +404 -0
- clutterxp/gui/views/folders.py +354 -0
- clutterxp/gui/views/history.py +281 -0
- clutterxp/gui/views/preview.py +277 -0
- clutterxp/gui/views/rules.py +527 -0
- clutterxp/gui/views/settings.py +172 -0
- clutterxp/gui/workers.py +147 -0
- clutterxp/history/__init__.py +23 -0
- clutterxp/history/db.py +174 -0
- clutterxp/history/pathcodec.py +42 -0
- clutterxp/history/recovery.py +318 -0
- clutterxp/history/schema.sql +43 -0
- clutterxp/history/service.py +493 -0
- clutterxp/history/undo.py +373 -0
- clutterxp/interfaces.py +164 -0
- clutterxp/locking.py +113 -0
- clutterxp/logging_setup.py +73 -0
- clutterxp/models.py +266 -0
- clutterxp/mover/__init__.py +26 -0
- clutterxp/mover/collision.py +46 -0
- clutterxp/mover/fsops.py +191 -0
- clutterxp/mover/safe_move.py +741 -0
- clutterxp/organizer.py +388 -0
- clutterxp/packaging/clutterxp.service +15 -0
- clutterxp/paths.py +112 -0
- clutterxp/planner.py +339 -0
- clutterxp/py.typed +0 -0
- clutterxp/rules/__init__.py +16 -0
- clutterxp/rules/engine.py +374 -0
- clutterxp/rules/matcher.py +222 -0
- clutterxp/rules/template.py +171 -0
- clutterxp/rules/tokenizer.py +118 -0
- clutterxp/safety.py +111 -0
- clutterxp/scanner.py +196 -0
- clutterxp/service_install.py +208 -0
- clutterxp/units.py +59 -0
- clutterxp/watch/__init__.py +37 -0
- clutterxp/watch/debounce.py +84 -0
- clutterxp/watch/events.py +259 -0
- clutterxp/watch/ignore.py +77 -0
- clutterxp/watch/service.py +662 -0
- clutterxp/watch/settle.py +170 -0
- clutterxp-1.1.0.dist-info/METADATA +149 -0
- clutterxp-1.1.0.dist-info/RECORD +84 -0
- clutterxp-1.1.0.dist-info/WHEEL +4 -0
- clutterxp-1.1.0.dist-info/entry_points.txt +6 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Ignore pattern matching for watch service (built-ins, hidden files, user globs)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import fnmatch
|
|
6
|
+
from collections.abc import Sequence
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
BUILTIN_IGNORE: tuple[str, ...] = (
|
|
10
|
+
"*.crdownload",
|
|
11
|
+
"*.part",
|
|
12
|
+
"*.partial",
|
|
13
|
+
"*.tmp",
|
|
14
|
+
"*.temp",
|
|
15
|
+
"*.download",
|
|
16
|
+
"*.opdownload",
|
|
17
|
+
"*.!qB",
|
|
18
|
+
"*.aria2",
|
|
19
|
+
"*.swp",
|
|
20
|
+
"*.swx",
|
|
21
|
+
"*~",
|
|
22
|
+
"~$*",
|
|
23
|
+
".~lock.*#",
|
|
24
|
+
"*.clutterxp-partial",
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class IgnoreMatcher:
|
|
29
|
+
"""Matches files against built-in and configured ignore patterns."""
|
|
30
|
+
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
builtin: Sequence[str] = BUILTIN_IGNORE,
|
|
34
|
+
global_extra: Sequence[str] = (),
|
|
35
|
+
folder_extra: Sequence[str] = (),
|
|
36
|
+
skip_hidden: bool = True,
|
|
37
|
+
) -> None:
|
|
38
|
+
self.builtin = tuple(builtin)
|
|
39
|
+
self.global_extra = tuple(global_extra)
|
|
40
|
+
self.folder_extra = tuple(folder_extra)
|
|
41
|
+
self.skip_hidden = skip_hidden
|
|
42
|
+
self._patterns = tuple(
|
|
43
|
+
p.casefold() for p in (*self.builtin, *self.global_extra, *self.folder_extra)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
def matches(self, path: Path) -> bool:
|
|
47
|
+
"""Return True if path should be ignored."""
|
|
48
|
+
name = path.name
|
|
49
|
+
if not name:
|
|
50
|
+
return True
|
|
51
|
+
|
|
52
|
+
# ClutterXP's internal partial transfer files are always ignored
|
|
53
|
+
name_cf = name.casefold()
|
|
54
|
+
if name_cf.endswith(".clutterxp-partial"):
|
|
55
|
+
return True
|
|
56
|
+
|
|
57
|
+
# Skip hidden files or files within hidden directories
|
|
58
|
+
if self.skip_hidden:
|
|
59
|
+
for part in path.parts:
|
|
60
|
+
if part.startswith(".") and part not in (".", ".."):
|
|
61
|
+
return True
|
|
62
|
+
|
|
63
|
+
# Casefolded fnmatch matching on path.name
|
|
64
|
+
for pattern in self._patterns:
|
|
65
|
+
if fnmatch.fnmatchcase(name_cf, pattern):
|
|
66
|
+
return True
|
|
67
|
+
if "/" in pattern:
|
|
68
|
+
posix_path = path.as_posix().casefold()
|
|
69
|
+
if fnmatch.fnmatchcase(posix_path, pattern) or fnmatch.fnmatchcase(
|
|
70
|
+
posix_path, f"*/{pattern.lstrip('/')}"
|
|
71
|
+
):
|
|
72
|
+
return True
|
|
73
|
+
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
__all__ = ["BUILTIN_IGNORE", "IgnoreMatcher"]
|