PyAnimCLI 0.1.0__tar.gz → 0.1.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyAnimCLI
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Animações de terminal em Python (progress bar, spinner, loaders)
5
5
  Author-email: João <joao6ag@gmail.com>
6
6
  License: MIT
@@ -0,0 +1,3 @@
1
+ from .progressbar import ProgressBar
2
+ from .charani import CharAni
3
+ __all__ = ["ProgressBar","CharAni"]
@@ -2,39 +2,11 @@ import sys
2
2
  import time
3
3
  import importlib
4
4
 
5
- class ProgressBar:
6
-
7
- # ===============================
8
- # 🔹 ImportLib (real)
9
- # ===============================
10
- class ImportLib:
11
- def __init__(self, speed: float, libs: list[str]):
12
- self.speed = speed
13
- self.libs = libs
14
- self.total = len(libs)
15
-
16
- def _draw(self, current, size=30):
17
- percent = current / self.total
18
- filled = int(size * percent)
19
- bar = "█" * filled + "-" * (size - filled)
20
- sys.stdout.write(
21
- f"\r[{bar}] {int(percent*100)}% ({current}/{self.total})"
22
- )
23
- sys.stdout.flush()
24
-
25
- def start(self):
26
- for i, lib in enumerate(self.libs, 1):
27
- try:
28
- importlib.import_module(lib)
29
- time.sleep(self.speed)
30
- except Exception as e:
31
- sys.stdout.write(f"\n❌ {lib}: {e}\n")
32
- self._draw(i)
33
5
 
34
- print("\n✔ Imports concluídos")
6
+ class ProgressBar:
35
7
 
36
8
  # ===============================
37
- # 🔹 Normal (fake)
9
+ # 🔹 Barra FAKE
38
10
  # ===============================
39
11
  class Normal:
40
12
  def __init__(self, style="block", speed=0.05):
@@ -54,12 +26,59 @@ class ProgressBar:
54
26
 
55
27
  for i in range(total + 1):
56
28
  percent = i / total
57
- size = 30
58
- filled = int(size * percent)
59
- bar = fill * filled + empty * (size - filled)
29
+ filled = int(30 * percent)
30
+ bar = fill * filled + empty * (30 - filled)
60
31
 
61
- sys.stdout.write(f"\r[{bar}] {int(percent*100)}%")
32
+ sys.stdout.write(
33
+ f"\r[{bar}] {int(percent * 100)}%"
34
+ )
62
35
  sys.stdout.flush()
63
36
  time.sleep(self.speed)
64
37
 
65
- print("\n✔ Finalizado")
38
+ print("\n✔ Finalizado")
39
+
40
+ # ===============================
41
+ # 🔹 Import REAL
42
+ # ===============================
43
+ class ImportLib:
44
+ def __init__(self, speed, libs, inject=False):
45
+ self.speed = speed
46
+ self.libs = libs
47
+ self.inject = inject
48
+ self.total = len(libs)
49
+ self.modules = {}
50
+
51
+ self._blocked = {
52
+ "builtins", "__builtins__", "__main__"
53
+ }
54
+
55
+ def _draw(self, current, size=30):
56
+ percent = current / self.total
57
+ filled = int(size * percent)
58
+ bar = "█" * filled + "-" * (size - filled)
59
+ sys.stdout.write(
60
+ f"\r[{bar}] {int(percent * 100)}%"
61
+ )
62
+ sys.stdout.flush()
63
+
64
+ def start(self):
65
+ caller_globals = sys._getframe(1).f_globals
66
+
67
+ for i, lib in enumerate(self.libs, 1):
68
+ if lib in self._blocked:
69
+ raise ValueError(
70
+ f"Import proibido: {lib}"
71
+ )
72
+
73
+ module = importlib.import_module(lib)
74
+ self.modules[lib] = module
75
+
76
+ # 😈 modo mágico
77
+ if self.inject:
78
+ caller_globals[lib] = module
79
+
80
+ time.sleep(self.speed)
81
+ self._draw(i)
82
+
83
+ print("\n✔ Imports prontos")
84
+ return self.modules
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyAnimCLI
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Animações de terminal em Python (progress bar, spinner, loaders)
5
5
  Author-email: João <joao6ag@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PyAnimCLI"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "Animações de terminal em Python (progress bar, spinner, loaders)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -1,2 +0,0 @@
1
- from .progressbar import ProgressBar
2
- from .charani import CharAni
File without changes
File without changes
File without changes
File without changes