detect map_imperatively() called twice
Fixed issue where calling upon :meth:`_orm.regsitry.map_imperatively` more
than once for the same class would produce an unexpected error, rather than
an informative error that the target class is already mapped. This behavior
differed from that of the :func:`_orm.mapper` function which does report an
informative message already.
For 2.0, this change also cleans up the logic that detects against
`Mapper()` or `_mapper()` being invoked directly. 1.4's backport will
take on a different format as `mapper()` is still public API in that
release.
Fixes: #7579
Change-Id: Ie74a1a2e97f8b6a81ac1942040edd8cae82f4bd8
(cherry picked from commit
e6ded82eef63235d7cbfe3ab3382a48f32913640)