chore(backend): update template to v0.6.0, conflicts left
This commit is contained in:
1 parent
aa5361c88b
commit
e730b88d6d
12 files changed
+109
-21
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
HEAVY = ["aiogram", "pyrogram", "fastapi", "google.genai"]
|
||||
SERVICES = {
|
||||
"api": (["api.app"], {"fastapi"}),
|
||||
"userbot": (["userbot.runner", "userbot.handlers"], {"pyrogram"}),
|
||||
}
|
||||
PROBE = """
|
||||
import importlib, sys
|
||||
for module in sys.argv[1].split(","):
|
||||
importlib.import_module(module)
|
||||
print(" ".join(name for name in sys.argv[2:] if name in sys.modules))
|
||||
"""
|
||||
ENV = dict(os.environ)
|
||||
|
||||
|
||||
def loaded(modules: list[str]) -> tuple[set[str], str]:
|
||||
result = subprocess.run( # noqa: S603
|
||||
[sys.executable, "-c", PROBE, ",".join(modules), *HEAVY],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
cwd="src",
|
||||
env=ENV,
|
||||
check=False,
|
||||
)
|
||||
error = (result.stderr.strip().splitlines() or ["exit code"])[-1]
|
||||
return set(result.stdout.split()) & set(HEAVY), error if result.returncode else ""
|
||||
|
||||
|
||||
def main() -> int:
|
||||
failed = False
|
||||
for service, (modules, allowed) in SERVICES.items():
|
||||
found, error = loaded(modules)
|
||||
extra = sorted(found - allowed)
|
||||
status = error or ("imports " + ", ".join(extra) if extra else "")
|
||||
print(f"{service:10s} {'FAIL: ' + status if status else 'ok'}")
|
||||
failed |= bool(status)
|
||||
return int(failed)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -5,6 +5,7 @@ from userbot.modules.client import PyroClient
|
||||
from utils.env import env
|
||||
from utils.logging import logger, setup_logging
|
||||
|
||||
<<<<<<< before updating
|
||||
setup_logging()
|
||||
|
||||
|
||||
@@ -18,6 +19,9 @@ def _finalize_session(sessions_dir: Path, name: str) -> Path:
|
||||
target = sessions_dir / f"{name}.session"
|
||||
(sessions_dir / "generated.session").rename(target)
|
||||
return target
|
||||
=======
|
||||
from userbot.modules.client import PyroClient
|
||||
>>>>>>> after updating
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
|
||||
Reference in new issue
Block a user