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.
- {pyanimcli-0.1.0/PyAnimCLI.egg-info → pyanimcli-0.1.1}/PKG-INFO +1 -1
- pyanimcli-0.1.1/PyAni/__init__.py +3 -0
- {pyanimcli-0.1.0 → pyanimcli-0.1.1}/PyAni/progressbar.py +54 -35
- {pyanimcli-0.1.0 → pyanimcli-0.1.1/PyAnimCLI.egg-info}/PKG-INFO +1 -1
- {pyanimcli-0.1.0 → pyanimcli-0.1.1}/pyproject.toml +1 -1
- pyanimcli-0.1.0/PyAni/__init__.py +0 -2
- {pyanimcli-0.1.0 → pyanimcli-0.1.1}/LICENSE +0 -0
- {pyanimcli-0.1.0 → pyanimcli-0.1.1}/PyAni/charani.py +0 -0
- {pyanimcli-0.1.0 → pyanimcli-0.1.1}/PyAnimCLI.egg-info/SOURCES.txt +0 -0
- {pyanimcli-0.1.0 → pyanimcli-0.1.1}/PyAnimCLI.egg-info/dependency_links.txt +0 -0
- {pyanimcli-0.1.0 → pyanimcli-0.1.1}/PyAnimCLI.egg-info/top_level.txt +0 -0
- {pyanimcli-0.1.0 → pyanimcli-0.1.1}/README.md +0 -0
- {pyanimcli-0.1.0 → pyanimcli-0.1.1}/setup.cfg +0 -0
|
@@ -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
|
-
|
|
6
|
+
class ProgressBar:
|
|
35
7
|
|
|
36
8
|
# ===============================
|
|
37
|
-
# 🔹
|
|
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
|
-
|
|
58
|
-
|
|
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(
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|