Check whether *annot* is a typing.ClassVar. The string comparison hack is used to avoid evaluating all string annotations which would put attrs-based classes at a performance disadvantage compared to plain old classes.
(annot)
| 292 | |
| 293 | |
| 294 | def _is_class_var(annot): |
| 295 | """ |
| 296 | Check whether *annot* is a typing.ClassVar. |
| 297 | |
| 298 | The string comparison hack is used to avoid evaluating all string |
| 299 | annotations which would put attrs-based classes at a performance |
| 300 | disadvantage compared to plain old classes. |
| 301 | """ |
| 302 | annot = str(annot) |
| 303 | |
| 304 | # Annotation can be quoted. |
| 305 | if annot.startswith(("'", '"')) and annot.endswith(("'", '"')): |
| 306 | annot = annot[1:-1] |
| 307 | |
| 308 | return annot.startswith(_CLASSVAR_PREFIXES) |
| 309 | |
| 310 | |
| 311 | def _has_own_attribute(cls, attrib_name): |
no outgoing calls