3 changed files with 0 additions and 60 deletions
@ -1,6 +0,0 @@ |
|||
mixins |
|||
====== |
|||
|
|||
.. automodule:: steam.client.mixins |
|||
|
|||
|
@ -1,53 +0,0 @@ |
|||
""" |
|||
All optional features are available as mixins for :class:`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. |
|||
|
|||
.. code:: python |
|||
|
|||
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 <https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references>`_ |
|||
|
|||
|
|||
.. code:: python |
|||
|
|||
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() |
|||
|
|||
.. code:: python |
|||
|
|||
>>> client.my_property |
|||
42 |
|||
>>> client.my_method() |
|||
Hello! |
|||
|
|||
""" |
Loading…
Reference in new issue