1 '''Replace auto-generated classes with our own, where necessary.
4 from . import _client
, _definitions
, overrides
# isort:skip
6 for o
in overrides
.__all
__:
8 # Override stuff in _definitions, which is all imported
9 # into _client. We Monkey patch both the original class and
10 # the ref in _client (import shenanigans are fun!)
11 setattr(_definitions
, o
, getattr(overrides
, o
))
12 setattr(_client
, o
, getattr(overrides
, o
))
13 # We shouldn't be overriding Facades!
16 "Cannot override a versioned Facade class -- you must patch "
19 for o
in overrides
.__patches
__:
20 # Patch a versioned Facade.
21 for client_version
in _client
.CLIENTS
.values():
23 c_type
= getattr(client_version
, o
)
24 except AttributeError:
25 # Not all the _client<version> modules may have the
26 # facade. That's okay -- we just skip over them.
28 o_type
= getattr(overrides
, o
)
30 if not a
.startswith('_'):
31 setattr(c_type
, a
, getattr(o_type
, a
))
33 from ._client
import * # noqa, isort:skip