Helper to ease use of annotationlib.ForwardRef in tests. This checks only attributes that can be set using the constructor.
| 3239 | return _support_remote_exec_only_impl()(test) |
| 3240 | |
| 3241 | class EqualToForwardRef: |
| 3242 | """Helper to ease use of annotationlib.ForwardRef in tests. |
| 3243 | |
| 3244 | This checks only attributes that can be set using the constructor. |
| 3245 | |
| 3246 | """ |
| 3247 | |
| 3248 | def __init__( |
| 3249 | self, |
| 3250 | arg, |
| 3251 | *, |
| 3252 | module=None, |
| 3253 | owner=None, |
| 3254 | is_class=False, |
| 3255 | ): |
| 3256 | self.__forward_arg__ = arg |
| 3257 | self.__forward_is_class__ = is_class |
| 3258 | self.__forward_module__ = module |
| 3259 | self.__owner__ = owner |
| 3260 | |
| 3261 | def __eq__(self, other): |
| 3262 | if not isinstance(other, (EqualToForwardRef, annotationlib.ForwardRef)): |
| 3263 | return NotImplemented |
| 3264 | return ( |
| 3265 | self.__forward_arg__ == other.__forward_arg__ |
| 3266 | and self.__forward_module__ == other.__forward_module__ |
| 3267 | and self.__forward_is_class__ == other.__forward_is_class__ |
| 3268 | and self.__owner__ == other.__owner__ |
| 3269 | ) |
| 3270 | |
| 3271 | def __repr__(self): |
| 3272 | extra = [] |
| 3273 | if self.__forward_module__ is not None: |
| 3274 | extra.append(f", module={self.__forward_module__!r}") |
| 3275 | if self.__forward_is_class__: |
| 3276 | extra.append(", is_class=True") |
| 3277 | if self.__owner__ is not None: |
| 3278 | extra.append(f", owner={self.__owner__!r}") |
| 3279 | return f"EqualToForwardRef({self.__forward_arg__!r}{''.join(extra)})" |
| 3280 | |
| 3281 | |
| 3282 | _linked_to_musl = None |
no outgoing calls
searching dependent graphs…