summaryrefslogtreecommitdiff
path: root/examples/statemachine/libraryBookDemo.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/statemachine/libraryBookDemo.py')
-rw-r--r--examples/statemachine/libraryBookDemo.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/examples/statemachine/libraryBookDemo.py b/examples/statemachine/libraryBookDemo.py
index 98f0b2b..61bdd6d 100644
--- a/examples/statemachine/libraryBookDemo.py
+++ b/examples/statemachine/libraryBookDemo.py
@@ -26,7 +26,11 @@ class RestrictedBook(Book):
if user in self._authorized_users:
super().checkout()
else:
- raise Exception("{} could not check out restricted book".format(user if user is not None else "anonymous"))
+ raise Exception(
+ "{} could not check out restricted book".format(
+ user if user is not None else "anonymous"
+ )
+ )
def run_demo():
@@ -41,9 +45,9 @@ def run_demo():
print(book)
try:
book.checkout()
- except Exception as e: # statemachine.InvalidTransitionException:
+ except Exception as e: # statemachine.InvalidTransitionException:
print(e)
- print('..cannot check out reserved book')
+ print("..cannot check out reserved book")
book.release()
print(book)
book.checkout()
@@ -58,13 +62,13 @@ def run_demo():
try:
restricted_book.checkout(name)
except Exception as e:
- print('..' + str(e))
+ print(".." + str(e))
else:
- print('checkout to', name)
+ print("checkout to", name)
print(restricted_book)
restricted_book.checkin()
print(restricted_book)
-if __name__ == '__main__':
+if __name__ == "__main__":
run_demo()