Skip to content

Commit 0d2130b

Browse files
committed
reintroduce __init__ parameter docs in the class docstring
1 parent 12e9f79 commit 0d2130b

3 files changed

Lines changed: 22 additions & 9 deletions

File tree

effect/_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Effect(object):
1919
allow binding callbacks to be called with the result of the effect.
2020
2121
Effects can be performed with :func:`perform`.
22+
23+
:param intent: The intent to be performed.
2224
"""
2325

2426
intent = attr.ib()

effect/_dispatcher.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
class TypeDispatcher(object):
1212
"""
1313
An Effect dispatcher which looks up the performer to use by type.
14-
"""
1514
15+
:param mapping: mapping of intent type to performer
16+
"""
1617
mapping = attr.ib()
1718

1819
def __call__(self, intent):
@@ -25,15 +26,11 @@ class ComposedDispatcher(object):
2526
A dispatcher which composes other dispatchers.
2627
2728
The dispatchers given will be searched in order until a performer is found.
29+
30+
:param dispatchers: Dispatchers to search.
2831
"""
2932

3033
dispatchers = attr.ib()
3134

32-
def __init__(self, dispatchers):
33-
"""
34-
:param collections.Iterable dispatchers: Dispatchers to search.
35-
"""
36-
self.dispatchers = dispatchers
37-
3835
def __call__(self, intent):
3936
return next(filter(None, (d(intent) for d in self.dispatchers)), None)

effect/_intents.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class ParallelEffects(object):
4141
4242
Performers of this intent must fail with a :obj:`FirstError` exception when
4343
any child effect fails, representing the first error.
44+
45+
:param effects: Effects to be performed in parallel.
4446
"""
4547

4648
effects = attr.ib()
@@ -102,13 +104,19 @@ class Delay(object):
102104
103105
When performed, the specified delay will pass and then the effect will
104106
result in None.
107+
108+
:param float delay: The number of seconds to delay.
105109
"""
106110
delay = attr.ib()
107111

108112

109113
@attr.s
110114
class Constant(object):
111-
"""An intent that returns a pre-specified result when performed."""
115+
"""
116+
An intent that returns a pre-specified result when performed.
117+
118+
:param result: The object which the Effect will result in.
119+
"""
112120
result = attr.ib()
113121

114122

@@ -120,7 +128,11 @@ def perform_constant(dispatcher, intent):
120128

121129
@attr.s
122130
class Error(object):
123-
"""An intent that raises a pre-specified exception when performed."""
131+
"""
132+
An intent that raises a pre-specified exception when performed.
133+
134+
:param BaseException exception: Exception instance to raise.
135+
"""
124136
exception = attr.ib()
125137

126138

@@ -149,6 +161,8 @@ class Func(object):
149161
intents as inert objects with public attributes of simple data. However,
150162
this is useful for integrating wih "legacy" side-effecting code in a quick
151163
way.
164+
165+
:param func: The function to call when this intent is performed.
152166
"""
153167
func = attr.ib()
154168

0 commit comments

Comments
 (0)