From f73e2571fb643a2afdde365eeee0fe0f3f4f5300 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 24 Oct 2019 20:11:14 -0700 Subject: Use pyupgrade to upgrade the code to use Python3 conventions (#138) The pyupgrade project is available at https://github.com/asottile/pyupgrade and can be installed through pip. The pyupgrade tool automatically upgrades syntax for newer versions of the language. As pyparsing is now Python 3 only, can apply some cleanups and simplifications. Ran the tool using the following command: $ find . -name \*.py -exec pyupgrade --py3-plus {} \; For now, pyparsing.py was skipped while it is refactored to a package. --- examples/statemachine/libraryBookDemo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/statemachine/libraryBookDemo.py') diff --git a/examples/statemachine/libraryBookDemo.py b/examples/statemachine/libraryBookDemo.py index a5e018d..98f0b2b 100644 --- a/examples/statemachine/libraryBookDemo.py +++ b/examples/statemachine/libraryBookDemo.py @@ -15,7 +15,7 @@ class Book(librarybookstate.BookStateMixin): class RestrictedBook(Book): def __init__(self): - super(RestrictedBook, self).__init__() + super().__init__() self._authorized_users = [] def authorize(self, name): @@ -26,7 +26,7 @@ class RestrictedBook(Book): if user in self._authorized_users: super().checkout() else: - raise Exception("{0} 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(): -- cgit v1.2.1