Skip to content

Commit 5522e46

Browse files
author
Shehab Abdel-Salam
committed
Tidy up
1 parent 1402af0 commit 5522e46

File tree

14 files changed

+17
-19
lines changed

14 files changed

+17
-19
lines changed

chapters/chapter10_oop/exercises/exercise_70.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# circle = Circle(5)
1111
# assert circle.area() == 78.54
1212

13-
from abc import ABC, abstractmethod
13+
from abc import ABC, abstractmethod # noqa: F401
1414

1515
PI = 3.14159
1616

chapters/chapter10_oop/exercises/exercise_72.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# assert shelf.get_books_by_genre(Genre.Fiction) == [book1, book2]
2222
# shelf.remove_book(book1)
2323

24-
from .exercise_71 import Book, Genre
24+
from .exercise_71 import Book, Genre # noqa: F401
2525

2626

2727
class BookShelf:

chapters/chapter10_oop/exercises/exercise_73.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
# assert library.is_book_in_library(Book("Non Existing Book", author, 2021, Genre.Fiction)) is False
2727
# library.remove_shelf(shelf1)
2828
# assert library.get_books() == [book2]
29-
from .exercise_71 import Book, Genre
30-
from .exercise_72 import BookShelf
29+
from .exercise_71 import Book, Genre # noqa: F401
30+
from .exercise_72 import BookShelf # noqa: F401
3131

3232

3333
class Library:

chapters/chapter10_oop/exercises/exercise_74.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# 5. total_balance (a float)
2525

2626
from __future__ import annotations
27-
from dataclasses import dataclass, field
27+
from dataclasses import dataclass, field # noqa: F401
2828

2929

3030
@dataclass
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
# Exercise 81 - Functools
22
# Write a function that uses `functools.partial` to create a function that always multiplies by 10.
3-
from functools import partial
43

54

65
def multiply(x, y):
76
return x * y
87

98

10-
def multiply(): ...
11-
12-
139
multiply_by_10 = ...

chapters/chapter11_standard_library/exercises/exercise_82.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Exercise 82 - Flatten a List of Lists
22
# Write a function that flattens a list of lists using `itertools.chain`.
33
# The function should take a list of lists and return a single flattened list.
4-
from itertools import chain
54

65
# Example:
76
# flatten_list_of_lists([[1, 2, 3], [4, 5], [6, 7, 8, 9]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9]

chapters/chapter11_standard_library/exercises/exercise_83.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Exercise 83 - Cached Fibonacci
22
# Given this fibonacci function, we want to cache the results using `functools.lru`.
3-
from functools import lru_cache
43

54

65
def compute_fibonacci(n: int) -> int:

chapters/chapter11_standard_library/exercises/exercise_84.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Can you fix this?
77

8-
import logging
8+
import logging # noqa: F401
99

1010

1111
class RateInterestCalculator:

chapters/chapter11_standard_library/exercises/exercise_85.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# The timestamp should be converted to a `datetime` object.
55
#
66
from dataclasses import dataclass
7-
from datetime import datetime
7+
from datetime import datetime # noqa: F401
88

99
# Example:
1010
# 2024-09-01,Sold 100 shares of AAPL

chapters/chapter14_testing/tests/test_ch14.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import pytest
2-
from ..exercises.exercise_94 import clean_text
3-
from ..exercises.exercise_95 import SalaryCalculator
4-
from ..exercises.exercise_96 import ProductSalesCalculator, Discount
1+
import pytest # noqa: F401
2+
from ..exercises.exercise_94 import clean_text # noqa
3+
from ..exercises.exercise_95 import SalaryCalculator # noqa: F401
4+
from ..exercises.exercise_96 import ProductSalesCalculator, Discount # noqa: F401
55

66

77
def test_e94():

chapters/chapter15_concurrency/exercises/exercise_100.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Exercise 100 - Decorator for Async Functions
22
# Given the following `time_it` decorator, extend it to support async functions.
3+
# NOTE: To run the unit tests for this exercise, you need to install the following:
4+
# $ pip install pytest pytest-asyncio
35

46
import asyncio
57
from functools import wraps

chapters/chapter15_concurrency/exercises/exercise_97.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Spin up a new thread for each row in the matrix to calculate the
66
# sum of the two matrices.
77
# Use the threading module to accomplish this task.
8-
import threading
8+
import threading # noqa
99

1010

1111
def add_matrices(matrix1: list[list[int]], matrix2: list[list[int]]) -> list[list[int]]:

chapters/chapter15_concurrency/exercises/exercise_98.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Exercise 98 - Asynchronous Processing
22
# Write an asynchronous function that fetches data from multiple sources and processes it concurrently.
33
# The function should take a list of sources and return a list of processed data.
4+
# NOTE: To run the unit tests for this exercise, you need to install the following:
5+
# $ pip install pytest pytest-asyncio
46

57
import asyncio
68
import random

chapters/chapter15_concurrency/exercises/exercise_99.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# and withdraw operations.
44
# Modify the class to make it thread-safe so that it can handle
55
# concurrent deposits and withdrawals correctly.
6-
import threading
6+
import threading # noqa
77

88

99
class BankAccount:

0 commit comments

Comments
 (0)