diff --git a/11-iface-abc/lotto.py b/11-iface-abc/lotto.py index 2295b71..da8c2de 100644 --- a/11-iface-abc/lotto.py +++ b/11-iface-abc/lotto.py @@ -17,7 +17,7 @@ def pick(self): try: position = random.randrange(len(self._balls)) # <2> except ValueError: - raise LookupError('pick from empty BingoCage') + raise LookupError('pick from empty LotteryBlower') return self._balls.pop(position) # <3> def loaded(self): # <4> diff --git a/18-asyncio-py3.7/README.rst b/18-asyncio-py3.7/README.rst index 0f4f1b8..aad52a3 100644 --- a/18-asyncio-py3.7/README.rst +++ b/18-asyncio-py3.7/README.rst @@ -4,8 +4,8 @@ From the book "Fluent Python" by Luciano Ramalho (O'Reilly, 2015) http://shop.oreilly.com/product/0636920032519.do ################################################################## -NOTE: this "18b" directory contains the examples of chapter 18 -rewritten using the new async/await syntax available in Python 3.5 -ONLY, instead of the "yield-from" syntax which works since Python -3.3 (and will still work with Python 3.5). +NOTE: this directory contains the examples of chapter 18 +rewritten using the new async/await syntax available from Python +3.5+, instead of the "yield-from" syntax of Python 3.3 and 3.4. +The code was tested with Python 3.7 ################################################################## diff --git a/18-asyncio/charfinder/charfinder.py b/18-asyncio/charfinder/charfinder.py index 4e97a0a..c061f90 100755 --- a/18-asyncio/charfinder/charfinder.py +++ b/18-asyncio/charfinder/charfinder.py @@ -163,7 +163,7 @@ def find_chars(self, query, start=0, stop=None): result_sets = [] for word in tokenize(query): chars = self.index.get(word) - if chars is None: # shorcut: no such word + if chars is None: # shortcut: no such word result_sets = [] break result_sets.append(chars) diff --git a/19-dyn-attr-prop/oscon/test_schedule1.py b/19-dyn-attr-prop/oscon/test_schedule1.py index dbaacc9..ba5dfd1 100644 --- a/19-dyn-attr-prop/oscon/test_schedule1.py +++ b/19-dyn-attr-prop/oscon/test_schedule1.py @@ -1,15 +1,20 @@ +import os import shelve + import pytest import schedule1 as schedule +DB_NAME = 'data/test_db' + -@pytest.yield_fixture +@pytest.fixture(scope='module') def db(): - with shelve.open(schedule.DB_NAME) as the_db: + with shelve.open(DB_NAME) as the_db: if schedule.CONFERENCE not in the_db: schedule.load_db(the_db) yield the_db + os.remove(DB_NAME) def test_record_class(): diff --git a/19-dyn-attr-prop/oscon/test_schedule2.py b/19-dyn-attr-prop/oscon/test_schedule2.py index de09d32..ab1c79c 100644 --- a/19-dyn-attr-prop/oscon/test_schedule2.py +++ b/19-dyn-attr-prop/oscon/test_schedule2.py @@ -1,15 +1,18 @@ +import os import shelve + import pytest import schedule2 as schedule -@pytest.yield_fixture +@pytest.fixture(scope='module') def db(): - with shelve.open(schedule.DB_NAME) as the_db: + with shelve.open(DB_NAME) as the_db: if schedule.CONFERENCE not in the_db: schedule.load_db(the_db) yield the_db + os.remove(DB_NAME) def test_record_attr_access(): diff --git a/README.rst b/README.rst index af75b88..39b95c4 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,8 @@ Fluent Python, First Edition: example code ========================================== +**This repository is archived and will not be updated. Please visit https://github.com/fluentpython/example-code-2e** + Example code for the book `Fluent Python, First Edition` by Luciano Ramalho (O'Reilly, 2015). * Code here may change and disappear without warning. diff --git a/attic/concurrency/charfinder/charfinder.py b/attic/concurrency/charfinder/charfinder.py index d18db89..72e21a4 100755 --- a/attic/concurrency/charfinder/charfinder.py +++ b/attic/concurrency/charfinder/charfinder.py @@ -165,7 +165,7 @@ def find_chars(self, query, start=0, stop=None): for word in tokenize(query): if word in self.index: result_sets.append(self.index[word]) - else: # shorcut: no such word + else: # shortcut: no such word result_sets = [] break if result_sets: