mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-03-22 06:10:51 -07:00
ci(M01): stub UPPER_CASE attrs as dict for ATTENTION_MODES etc
Made-with: Cursor
This commit is contained in:
parent
3fa2072363
commit
91fcade97d
1 changed files with 5 additions and 1 deletions
|
|
@ -26,13 +26,17 @@ import importlib.abc
|
|||
import importlib.machinery
|
||||
|
||||
def _make_stub_class(name):
|
||||
"""Stub class; any attr access returns no-op (for forward, etc.)."""
|
||||
"""Stub class; forward->noop, UPPER_CASE->{}, else->noop."""
|
||||
_noop = lambda *a, **k: None
|
||||
class _Meta(type):
|
||||
def __getattribute__(cls, attr):
|
||||
try:
|
||||
return type.__getattribute__(cls, attr)
|
||||
except AttributeError:
|
||||
if attr.isupper() or (attr and attr[0].isupper() and "_" in attr):
|
||||
d = {}
|
||||
object.__setattr__(cls, attr, d) # cache for future access
|
||||
return d
|
||||
return _noop
|
||||
return _Meta(name, (), {"forward": _noop})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue