okfn-brasil / rosie

🤖 Python application responsible for Serenata de Amor's intelligence
409 stars 60 forks source link

Simplify import Rosie classifiers #91

Closed lipemorais closed 7 years ago

lipemorais commented 7 years ago

What is the purpose of this Pull Request? Make less repetitive importing a classifier. The result would be something like this: Before from rosie.chamber_of_deputies.classifiers.election_expenses_classifier import ElectionExpensesClassifier After from rosie.chamber_of_deputies.classifiers import ElectionExpensesClassifier

The idea is just don't make necessary repeat the classifier file and the classifier class in sequence. At the end of this PR the idea is have the same behaviour for all classifiers. Before from rosie.<app>.classifiers.<classifier_file> import <classifier class> After from rosie.<app>.classifiers import <classifier class>

I changed a import on the test_election_expenses_classifier to show how it would look like in practice

What was done to achieve this purpose? I just used a trick on __init__ file.

How to test if it really works? You can run Rosie tests and check if everything keep working well with python rosie.py test

Who can help reviewing it? @cuducos @anaschwendler

TODO

lipemorais commented 7 years ago

Hey @cuducos @anaschwendler Could take a look and tell what you think about this change?

I finished the refactoring. I would like to know from you if is it able to be merged or not.