Construct an enum helper to account for PyQt5 <-> PyQt6 changes.
(QT_API, QtCore)
| 411 | |
| 412 | |
| 413 | def enum_factory(QT_API, QtCore): |
| 414 | """Construct an enum helper to account for PyQt5 <-> PyQt6 changes.""" |
| 415 | |
| 416 | @lru_cache(None) |
| 417 | def _enum(name): |
| 418 | # foo.bar.Enum.Entry (PyQt6) <=> foo.bar.Entry (non-PyQt6). |
| 419 | return operator.attrgetter( |
| 420 | name if QT_API == QT_API_PYQT6 else name.rpartition(".")[0] |
| 421 | )(sys.modules[QtCore.__package__]) |
| 422 | |
| 423 | return _enum |
no outgoing calls
no test coverage detected
searching dependent graphs…