We need to realize something like this:
>>> from elizabeth import Generic
>>> generic = Generic('en')
>>> class SomeProvider():
def hello(self):
return "Hello!"
>>> class Another():
def bye(self):
return "Bye!"
>>> generic.add_provider(SomeProvider)
>>> generic.add_provider(Another)
>>> generic.someprovider.hello()
>>> generic.another.bye()
# Hello!
# Bye!
@Battleroid What do you think about it? Do you have interest? If you can help me with this I could take the documentation update.
Sounds neat. Is there anything in particular you would like me to do? I'll try to get started on it in the morning.
@Battleroid We need just add_provider() method. It would be great if you can do it. Thank you very much!
Created PR #76, hopefully this is what you're looking for.
@Battleroid Thank you!
To be honest it's whatever you prefer. I think either way is good, the former might be preferable since you are just calling the class just as you would normally. The latter might be a little bit more odd since you're changing the case.
If need be though you could probably have add_provider name the new provider before setting it as an attribute by looking for a variable within the provider class, then defaulting to the class name if it's not available.
e.g. SampleProvider might have a subclass named Meta which contains our name.
class SampleProvider:
...
class Meta:
name = 'sampleprovider'
And we'd use Meta.name to label it, or even simpler,
class SampleProvider:
name = 'sampleprovider'
...
@Battleroid Variant with Meta is also great! Thank you!
Created PR #77 for the Meta class variant.
@Battleroid It's great! Thanks.
No problem, glad it works.
Most helpful comment
Sounds neat. Is there anything in particular you would like me to do? I'll try to get started on it in the morning.