-
Notifications
You must be signed in to change notification settings - Fork 164
refactor(BA-4189): move out of convention session function into valid directory #8513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| migrate unnecessary service related function from api to service |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||||||||||
| from __future__ import annotations | ||||||||||||||
|
|
||||||||||||||
| from collections.abc import Mapping | ||||||||||||||
| from typing import Any | ||||||||||||||
|
|
||||||||||||||
| from ai.backend.manager.api.utils import Undefined | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| def drop_undefined(d: dict[Any, Any]) -> dict[Any, Any]: | ||||||||||||||
| newd: dict[Any, Any] = {} | ||||||||||||||
| for k, v in d.items(): | ||||||||||||||
| if isinstance(v, (Mapping, dict)): | ||||||||||||||
| newval = drop_undefined(dict(v)) | ||||||||||||||
| if len(newval.keys()) > 0: # exclude empty dict always | ||||||||||||||
|
Comment on lines
+12
to
+14
|
||||||||||||||
| if isinstance(v, (Mapping, dict)): | |
| newval = drop_undefined(dict(v)) | |
| if len(newval.keys()) > 0: # exclude empty dict always | |
| if isinstance(v, Mapping): | |
| newval = drop_undefined(dict(v)) | |
| if newval: # exclude empty dict always |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
services/session/types.pynow pulls in trafaret/validators just to hostoverwritten_param_check. In this codebase, servicetypes.pyfiles appear to be kept as lightweight dataclass/type holders (e.g.services/vfolder/types.py,services/image/types.py), andservices/session/types.pyis imported by action modules that only need the dataclasses. Consider movingoverwritten_param_checkinto a dedicated module (e.g.services/session/validators.pyorschemas.py) so non-validation callers don’t pay the extra import-time dependency/overhead.