mixinsΒΆ
All optional features are available as mixins for steam.client.SteamClient
.
Using this approach the client can remain light yet flexible.
Functionality can be added through inheritance depending on the use case.
Here is quick example of how to use one of the available mixins.
from steam import SteamClient
from stema.client.mixins.somemixing import SomeMixing
class CustomSteamClient(SteamClient, SomeMixing):
pass
client = CustomSteamClient()
Making custom mixing is just as simple.
Warning
Take care not to override existing methods or properties, otherwise bad things will happen
Note
To avoid name collisions of non-public variables and methods, use Private Variables
class MyMixin(object):
def __init__(self, *args, **kwargs):
super(MyMixin, self).__init__(*args, **kwargs)
self.my_property = 42
def my_method(self)
print "Hello!"
class MySteamClient(SteamClient, MyMixin):
pass
client = MySteamClient()
>>> client.my_property
42
>>> client.my_method()
Hello!