cleanix-cli 1.0.1__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.
Files changed (64) hide show
  1. cleanix/__init__.py +4 -0
  2. cleanix/__main__.py +6 -0
  3. cleanix/cleaners/__init__.py +269 -0
  4. cleanix/cleaners/ai_cli.py +193 -0
  5. cleanix/cleaners/ai_tools.py +224 -0
  6. cleanix/cleaners/app_cruft.py +201 -0
  7. cleanix/cleaners/apple_litter.py +41 -0
  8. cleanix/cleaners/apps.py +89 -0
  9. cleanix/cleaners/apt.py +70 -0
  10. cleanix/cleaners/base.py +173 -0
  11. cleanix/cleaners/broken_symlinks.py +51 -0
  12. cleanix/cleaners/browsers.py +68 -0
  13. cleanix/cleaners/bsd.py +108 -0
  14. cleanix/cleaners/containers.py +82 -0
  15. cleanix/cleaners/coredumps.py +32 -0
  16. cleanix/cleaners/desktop_extras.py +42 -0
  17. cleanix/cleaners/dev_caches.py +57 -0
  18. cleanix/cleaners/distro_pkg.py +127 -0
  19. cleanix/cleaners/dnf.py +56 -0
  20. cleanix/cleaners/editor_litter.py +115 -0
  21. cleanix/cleaners/font_cache.py +29 -0
  22. cleanix/cleaners/ide.py +87 -0
  23. cleanix/cleaners/kernels.py +115 -0
  24. cleanix/cleaners/lang_caches.py +70 -0
  25. cleanix/cleaners/linux_extras.py +77 -0
  26. cleanix/cleaners/localizations.py +70 -0
  27. cleanix/cleaners/logs.py +80 -0
  28. cleanix/cleaners/macos.py +166 -0
  29. cleanix/cleaners/macos_extra.py +125 -0
  30. cleanix/cleaners/memory.py +110 -0
  31. cleanix/cleaners/more_pkg.py +168 -0
  32. cleanix/cleaners/npm_cache.py +36 -0
  33. cleanix/cleaners/packaging_extras.py +140 -0
  34. cleanix/cleaners/pacman.py +63 -0
  35. cleanix/cleaners/pip_cache.py +27 -0
  36. cleanix/cleaners/snapshots.py +126 -0
  37. cleanix/cleaners/sys_extras.py +109 -0
  38. cleanix/cleaners/temp_files.py +48 -0
  39. cleanix/cleaners/thumbnails.py +31 -0
  40. cleanix/cleaners/trash.py +47 -0
  41. cleanix/cleaners/user_cache.py +69 -0
  42. cleanix/cleaners/virtualization.py +76 -0
  43. cleanix/cli.py +810 -0
  44. cleanix/completion.py +131 -0
  45. cleanix/config.py +225 -0
  46. cleanix/core/__init__.py +1 -0
  47. cleanix/core/context.py +147 -0
  48. cleanix/core/engine.py +155 -0
  49. cleanix/core/history.py +55 -0
  50. cleanix/core/models.py +141 -0
  51. cleanix/core/platform.py +117 -0
  52. cleanix/core/quarantine.py +147 -0
  53. cleanix/core/registry.py +58 -0
  54. cleanix/core/report.py +130 -0
  55. cleanix/core/safety.py +166 -0
  56. cleanix/core/utils.py +244 -0
  57. cleanix/reset.py +328 -0
  58. cleanix/scheduler/__init__.py +1 -0
  59. cleanix/scheduler/systemd.py +160 -0
  60. cleanix_cli-1.0.1.dist-info/METADATA +436 -0
  61. cleanix_cli-1.0.1.dist-info/RECORD +64 -0
  62. cleanix_cli-1.0.1.dist-info/WHEEL +5 -0
  63. cleanix_cli-1.0.1.dist-info/entry_points.txt +2 -0
  64. cleanix_cli-1.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,76 @@
1
+ """VM / container / cloud-CLI leftovers."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import Iterable, Tuple
7
+
8
+ from cleanix.cleaners.base import Cleaner, SCOPE_SYSTEM
9
+ from cleanix.core.models import CleanableItem
10
+ from cleanix.core.platform import LINUX
11
+ from cleanix.core.utils import home, iter_children, path_size
12
+
13
+
14
+ class VmToolingCleaner(Cleaner):
15
+ id = "vm_tooling"
16
+ name = "VM & cloud tooling caches"
17
+ description = "VirtualBox logs, Vagrant boxes, k8s & cloud-CLI caches"
18
+ requires_root = False
19
+
20
+ def find_items(self) -> Iterable[CleanableItem]:
21
+ h = home()
22
+
23
+ # VirtualBox per-VM logs.
24
+ vbox = h / "VirtualBox VMs"
25
+ if vbox.is_dir():
26
+ for vm in iter_children(vbox):
27
+ logs = vm / "Logs"
28
+ if logs.is_dir() and path_size(logs) > 0:
29
+ item = self.path_item(logs, f"VirtualBox logs: {vm.name}")
30
+ if item:
31
+ yield item
32
+
33
+ # Simple regenerable caches.
34
+ simple: Iterable[Tuple[Path, str]] = (
35
+ (h / ".vagrant.d" / "tmp", "Vagrant temp"),
36
+ (h / ".vagrant.d" / "boxes", "Vagrant downloaded boxes"),
37
+ (h / ".kube" / "cache", "kubectl cache"),
38
+ (h / ".kube" / "http-cache", "kubectl HTTP cache"),
39
+ (h / ".minikube" / "cache", "minikube cache"),
40
+ (h / ".cache" / "helm", "Helm cache"),
41
+ (h / ".aws" / "cli" / "cache", "AWS CLI cache"),
42
+ (h / ".azure" / "logs", "Azure CLI logs"),
43
+ (h / ".config" / "gcloud" / "logs", "gcloud logs"),
44
+ (h / ".terraform.d" / "plugin-cache", "Terraform plugin cache"),
45
+ (h / ".cache" / "pulumi", "Pulumi cache"),
46
+ )
47
+ seen = set()
48
+ for path, label in simple:
49
+ if path in seen or not path.exists() or path_size(path) <= 0:
50
+ continue
51
+ seen.add(path)
52
+ item = self.path_item(path, label)
53
+ if item:
54
+ yield item
55
+
56
+
57
+ class LibvirtSaveReporter(Cleaner):
58
+ id = "libvirt_saves"
59
+ name = "libvirt saved VM states"
60
+ description = "Suspended-VM memory images (report only — real state)"
61
+ requires_root = True
62
+ platforms = (LINUX,)
63
+ scope = SCOPE_SYSTEM
64
+
65
+ def find_items(self) -> Iterable[CleanableItem]:
66
+ save = Path("/var/lib/libvirt/qemu/save")
67
+ if not save.is_dir():
68
+ return
69
+ for child in iter_children(save):
70
+ item = self.report_item(
71
+ child,
72
+ f"libvirt saved state: {child.name}",
73
+ hint="restore/discard with: virsh restore / virsh managedsave-remove <vm>",
74
+ )
75
+ if item:
76
+ yield item