PnX-SI / GeoNature

Application de saisie et de synthèse des observations faune et flore
GNU General Public License v3.0
100 stars 102 forks source link

[IMPORT] [BACKEND] [CHORE] chore: replace abc abstract by raise NotImplementedError in ImportMixin #3140

Closed edelclaux closed 2 months ago

edelclaux commented 2 months ago

C'est une PR proposition: vous pouvez la supprimer, je ne me vexe pas :)

On observe des warnings liés au polymorphisme, et à l'abstraction sur les modules. Le fait de basculer de l'approche du module ABC à l'approche artisanale raise NotImplementedError supprime ces warnings.

Je fais confiance aux tests pour voir si ça fonctionne correctement :)

/home/etienne/Documents/devel/geonature/ns-github/geonature_import/geonature/backend/venv/lib/python3.10/site-packages/flask_sqlalchemy/model.py:120: SAWarning: 
Mapper mapped class TModules_SyntheseImportMixin->t_modules does not indicate a polymorphic_identity, yet is part of an inheritance hierarchy that has a polymorphic_on column of 't_modules.type'.  
Objects of this type cannot be loaded polymorphically which can lead to degraded or incorrect loading behavior in some scenarios.  
Please establish a polmorphic_identity for this class, or leave it un-mapped.  
To omit mapping an intermediary class when using declarative, set the '__abstract__ = True' attribute on that class.
super().__init__(name, bases, d, **kwargs)

/home/etienne/Documents/devel/geonature/ns-github/geonature_import/geonature/backend/venv/lib/python3.10/site-packages/flask_sqlalchemy/model.py:120: SAWarning: 
Mapper mapped class TModules_OcchabImportMixin->t_modules does not indicate a polymorphic_identity, yet is part of an inheritance hierarchy that has a polymorphic_on column of 't_modules.type'.  
Objects of this type cannot be loaded polymorphically which can lead to degraded or incorrect loading behavior in some scenarios.  
Please establish a polmorphic_identity for this class, or leave it un-mapped.  To omit mapping an intermediary class when using declarative, set the '__abstract__ = True' attribute on that class.
super().__init__(name, bases, d, **kwargs)