| 56 | |
| 57 | |
| 58 | class _ProxyTypeDescriptor: |
| 59 | def __init__(self, name, p_type): |
| 60 | self.name = name |
| 61 | self.p_type = p_type |
| 62 | |
| 63 | def __get__(self, obj, cls): |
| 64 | return getattr(obj, self.name) |
| 65 | |
| 66 | def __set__(self, obj, value): |
| 67 | if self.name == "autodetect" and not isinstance(value, bool): |
| 68 | raise ValueError("Autodetect proxy value needs to be a boolean") |
| 69 | getattr(obj, "_verify_proxy_type_compatibility")(self.p_type) |
| 70 | setattr(obj, "proxyType", self.p_type) |
| 71 | setattr(obj, self.name, value) |
| 72 | |
| 73 | |
| 74 | class Proxy: |