-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
Currently, we shorten/obfuscate the module name when dynamically generating our framework-specific public API classes. E.g. when we create AsyncIOMotorClient we do:
def create_asyncio_class(cls): return create_class_with_framework(cls, asyncio_framework, 'motor_asyncio') AsyncIOMotorClient = create_asyncio_class(core.AgnosticClient)
with the factory function defined as:
def create_class_with_framework(cls, framework, module_name): motor_class_name = framework.CLASS_PREFIX + cls.__motor_class_name__ cache_key = (cls, motor_class_name, framework) cached_class = _class_cache.get(cache_key) if cached_class: return cached_class new_class = type(str(motor_class_name), cls.__bases__, cls.__dict__.copy()) new_class.__module__ = module_name new_class._framework = framework ... ...
Consequently, AsyncIOMotorClient appears to belong (as per its _module_ value) to the motor_asyncio module, even though it actually resides in motor.motor_asyncio. This creates problems when we attempt to use intersphinx to link to the MOTOR documentation as seen in MOTOR-338.
Unless there is a good rationale for fudging the _module_ of these classes, we should change the code so that it reflects the actual path.
- duplicates
-
MOTOR-338 Don't obfuscate full module name when generating framework-specific API classes
- Closed