Fix name mangling and typevar errors (dev branch)#929
Fix name mangling and typevar errors (dev branch)#929taylorfturner merged 3 commits intocapitalone:devfrom
Conversation
Inside the BaseDataProcessor class definition, references to __subclasses are automatically replaced with _BaseDataProcessor__subclasses. This remains the case even in static methods _register_subclass() and get_class(). Same with BaseModel and its __subclasses field. So we do not have to write out the full name mangled identifiers inside the class definitions. Also, mypy doesn't seem to be able to handle the return type of BaseDataProcessor.get_class() being a typevar, so that was changed to type[BaseDataProcessor]. This does not affect the functionality of get_class() since it always returns a subclass of BaseDataProcessor.
|
Whitesource license is stuck in "expected" status, so I'll push an empty commit |
| """For labeling data.""" | ||
|
|
||
| _BaseModel__subclasses: dict[str, type[BaseModel]] = {} | ||
| __subclasses: dict[str, type[BaseModel]] = {} |
This reverts commit c1abee6.
|
Need to revert to ensure |
|
The idea here is that we will take current |
|
Okay -- good to go on a re-open @junholee6a into |
Thanks for the heads up, I just re-made the branch and PR |
Issue: #722
Inside the
BaseDataProcessorclass definition, all references to__subclassesare automatically replaced with_BaseDataProcessor__subclasses. This remains the case even in static methods_register_subclass()andget_class(). Same withBaseModeland its__subclassesfield. So we do not have to write out the full name mangled identifiers inside the class definitions.Also, mypy doesn't seem to be able to handle the return type of
BaseDataProcessor.get_class()being a typevar, so that was changed totype[BaseDataProcessor]. This does not affect the functionality ofget_class()since it always returns a subclass ofBaseDataProcessor.This PR is a duplicate of #895, except it is based on the
devbranch instead ofmain