From 39846e052e488ad1a3edb531e81383d3ac115576 Mon Sep 17 00:00:00 2001 From: Marco Bakera Date: Thu, 6 May 2021 20:53:24 +0200 Subject: [PATCH 1/4] fixes for py3 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ff90f8f..1b0e2cc 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ The logic delegate can respond by setting the elevator to move up, move down, or >>> class Elevator(Elevator): ... def __init__(self, logic_delegate, starting_floor=1): ... self._current_floor = starting_floor - ... print "%s..." % starting_floor, + ... print(f"{starting_floor}...") ... self._motor_direction = None ... self._logic_delegate = logic_delegate ... self._logic_delegate.callbacks = self.Callbacks(self) @@ -71,7 +71,7 @@ The simulation runs in steps. Each time step consists of the elevator moving a s ... ... if delta: ... self._current_floor = self._current_floor + delta - ... print "%s..." % self._current_floor, + ... print(f"{self._current_floor}...") ... self._logic_delegate.on_floor_changed() ... else: ... self._logic_delegate.on_ready() From 5b0949d86bad167e944454385df04995a879f10c Mon Sep 17 00:00:00 2001 From: Marco Bakera Date: Thu, 6 May 2021 20:56:24 +0200 Subject: [PATCH 2/4] fix: travis use py3. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c126d99..8ff4ca0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: python python: - - "2.7" + - "3" script: python -m doctest README.md From f97b695286d7ec870f92c800644eee8b3c3df0ed Mon Sep 17 00:00:00 2001 From: Marco Bakera Date: Thu, 6 May 2021 21:01:40 +0200 Subject: [PATCH 3/4] fix: print py2 style --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b0e2cc..60dd015 100644 --- a/README.md +++ b/README.md @@ -274,7 +274,7 @@ No amount of legal moves should compel the elevator to enter an illegal state. H >>> import random >>> e = Elevator(ElevatorLogic()) 1... - >>> try: print '-', # doctest:+ELLIPSIS + >>> try: print('-') # doctest:+ELLIPSIS ... finally: ... for i in range(100000): ... r = random.randrange(6) From 82a94e0346c13e13664562def918645840a31c32 Mon Sep 17 00:00:00 2001 From: Marco Bakera Date: Fri, 7 May 2021 09:01:34 +0200 Subject: [PATCH 4/4] rm old style inheritance --- elevator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elevator.py b/elevator.py index b44c167..dcb1b43 100644 --- a/elevator.py +++ b/elevator.py @@ -2,7 +2,7 @@ DOWN = 2 FLOOR_COUNT = 6 -class ElevatorLogic(object): +class ElevatorLogic: """ An incorrect implementation. Can you make it pass all the tests?