(self, instance: LocalProxy[t.Any], owner: type | None = None)
| 308 | self.name = name |
| 309 | |
| 310 | def __get__(self, instance: LocalProxy[t.Any], owner: type | None = None) -> t.Any: |
| 311 | if instance is None: |
| 312 | if self.class_value is not None: |
| 313 | return self.class_value |
| 314 | |
| 315 | return self |
| 316 | |
| 317 | try: |
| 318 | obj = instance._get_current_object() |
| 319 | except RuntimeError: |
| 320 | if self.fallback is None: |
| 321 | raise |
| 322 | |
| 323 | fallback = self.fallback.__get__(instance, owner) |
| 324 | |
| 325 | if self.is_attr: |
| 326 | # __class__ and __doc__ are attributes, not methods. |
| 327 | # Call the fallback to get the value. |
| 328 | return fallback() |
| 329 | |
| 330 | return fallback |
| 331 | |
| 332 | if self.bind_f is not None: |
| 333 | return self.bind_f(instance, obj) |
| 334 | |
| 335 | return getattr(obj, self.name) |
| 336 | |
| 337 | def __repr__(self) -> str: |
| 338 | return f"proxy {self.name}" |
no test coverage detected