fix ruff: APIRouter type-checking import, replace print with sys.std* writes
This commit is contained in:
parent
de75cd777e
commit
466ce9dfb6
@ -17,7 +17,7 @@ from starlette.types import Receive, Scope, Send
|
||||
from litellm._logging import verbose_proxy_logger
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from fastapi import FastAPI
|
||||
from fastapi import APIRouter, FastAPI
|
||||
|
||||
|
||||
def _include_router(attr_name: str = "router") -> Callable[["FastAPI", object], None]:
|
||||
|
||||
@ -40,7 +40,7 @@ def generate_snapshot() -> Dict[str, Dict]:
|
||||
module = importlib.import_module(feat.module_path)
|
||||
feat.register_fn(app, module)
|
||||
except Exception as exc:
|
||||
print(f"warning: skip {feat.name}: {exc}", file=sys.stderr)
|
||||
sys.stderr.write(f"warning: skip {feat.name}: {exc}\n")
|
||||
|
||||
fragments: Dict[str, Dict] = {}
|
||||
for feat in LAZY_FEATURES:
|
||||
@ -67,4 +67,4 @@ def generate_snapshot() -> Dict[str, Dict]:
|
||||
if __name__ == "__main__":
|
||||
fragments = generate_snapshot()
|
||||
SNAPSHOT_FILE.write_text(json.dumps(fragments, indent=2, sort_keys=True) + "\n")
|
||||
print(f"wrote {len(fragments)} feature fragments to {SNAPSHOT_FILE}")
|
||||
sys.stdout.write(f"wrote {len(fragments)} feature fragments to {SNAPSHOT_FILE}\n")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user