Skip to content

Commit 19ed13b

Browse files
committed
convert tabs to spaces
1 parent c43f9c1 commit 19ed13b

2 files changed

Lines changed: 17 additions & 22 deletions

File tree

README.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,27 @@ A very quick example of using Effects:
4545
from effect import perform, sync_performer, Effect, TypeDispatcher
4646
4747
class ReadLine(object):
48-
def __init__(self, prompt):
49-
self.prompt = prompt
48+
def __init__(self, prompt):
49+
self.prompt = prompt
5050
5151
def get_user_name():
52-
return Effect(ReadLine("Enter a candy> "))
52+
return Effect(ReadLine("Enter a candy> "))
5353
5454
@sync_performer
5555
def perform_read_line(dispatcher, readline):
56-
return raw_input(readline.prompt)
56+
return raw_input(readline.prompt)
5757
5858
def main():
59-
effect = get_user_name()
60-
effect = effect.on(
61-
success=lambda result: print("I like {} too!".format(result)),
62-
error=lambda e: print("sorry, there was an error. {}".format(e)))
59+
effect = get_user_name()
60+
effect = effect.on(
61+
success=lambda result: print("I like {} too!".format(result)),
62+
error=lambda e: print("sorry, there was an error. {}".format(e)))
6363
64-
dispatcher = TypeDispatcher({ReadLine: perform_read_line})
65-
perform(dispatcher, effect)
64+
dispatcher = TypeDispatcher({ReadLine: perform_read_line})
65+
perform(dispatcher, effect)
6666
6767
if __name__ == '__main__':
68-
main()
68+
main()
6969
7070
7171
``Effect`` takes what we call an ``intent``, which is any object. The

docs/source/index.rst

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
.. Effect documentation master file, created by
2-
sphinx-quickstart on Mon Dec 22 12:01:30 2014.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
5-
61
Effect
72
======
83

@@ -53,16 +48,16 @@ simple objects with public attributes and no behavior, only data.
5348
.. code:: python
5449
5550
class ReadLine(object):
56-
def __init__(self, prompt):
57-
self.prompt = prompt
51+
def __init__(self, prompt):
52+
self.prompt = prompt
5853
5954
To perform the ReadLine intent, we must implement a performer function:
6055

6156
.. code:: python
6257
6358
@sync_performer
6459
def perform_read_line(dispatcher, readline):
65-
return raw_input(readline.prompt)
60+
return raw_input(readline.prompt)
6661
6762
6863
To do something with the result of the effect, we must attach callbacks with
@@ -73,7 +68,7 @@ the ``on`` method:
7368
def greet():
7469
return get_user_name().on(
7570
success=lambda r: Effect(Print("Hello,", r)),
76-
error=lambda exc_info: Effect(Print("There was an error!", exc_info[1])))
71+
error=lambda exc_info: Effect(Print("There was an error!", exc_info[1])))
7772
7873
7974
(Here we assume another intent, ``Print``, which shows some text to the user.)
@@ -102,7 +97,7 @@ based on the intent.
10297
10398
def main():
10499
eff = greet()
105-
dispatcher = TypeDispatcher({ReadLine: perform_read_line})
100+
dispatcher = TypeDispatcher({ReadLine: perform_read_line})
106101
perform(dispatcher, effect)
107102
108103
This has a number of advantages. First, your unit tests for ``get_user_name``
@@ -190,7 +185,7 @@ following:
190185
"""
191186
Perform an HTTP request where the body is sent as JSON and the response
192187
is automatically decoded as JSON if the Content-type is
193-
application/json.
188+
application/json.
194189
"""
195190
str_body = json.dumps(dict_body)
196191
return request_200_url(method, url, str_body).on(success=decode_json)

0 commit comments

Comments
 (0)