Skip to content

Commit 07560ea

Browse files
Merge branch 'master' into remove-some-per-file-ignores
2 parents 7ca6b10 + ea53051 commit 07560ea

File tree

87 files changed

+270
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+270
-189
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ repos:
1111
- id: requirements-txt-fixer
1212

1313
- repo: https://github.com/MarcoGorelli/auto-walrus
14-
rev: 0.3.3
14+
rev: 0.3.4
1515
hooks:
1616
- id: auto-walrus
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.3.7
19+
rev: v0.4.2
2020
hooks:
2121
- id: ruff
2222
- id: ruff-format
@@ -29,7 +29,7 @@ repos:
2929
- tomli
3030

3131
- repo: https://github.com/tox-dev/pyproject-fmt
32-
rev: "1.7.0"
32+
rev: "1.8.0"
3333
hooks:
3434
- id: pyproject-fmt
3535

@@ -47,7 +47,7 @@ repos:
4747
- id: validate-pyproject
4848

4949
- repo: https://github.com/pre-commit/mirrors-mypy
50-
rev: v1.9.0
50+
rev: v1.10.0
5151
hooks:
5252
- id: mypy
5353
args:

DIRECTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@
773773
* [Inverse Of Matrix](matrix/inverse_of_matrix.py)
774774
* [Largest Square Area In Matrix](matrix/largest_square_area_in_matrix.py)
775775
* [Matrix Class](matrix/matrix_class.py)
776+
* [Matrix Equalization](matrix/matrix_equalization.py)
776777
* [Matrix Multiplication Recursion](matrix/matrix_multiplication_recursion.py)
777778
* [Matrix Operation](matrix/matrix_operation.py)
778779
* [Max Area Of Island](matrix/max_area_of_island.py)

audio_filters/show_response.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from abc import abstractmethod
34
from math import pi
45
from typing import Protocol
56

@@ -8,14 +9,14 @@
89

910

1011
class FilterType(Protocol):
12+
@abstractmethod
1113
def process(self, sample: float) -> float:
1214
"""
1315
Calculate y[n]
1416
1517
>>> issubclass(FilterType, Protocol)
1618
True
1719
"""
18-
return 0.0
1920

2021

2122
def get_bounds(

backtracking/sudoku.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
Given a partially filled 9×9 2D array, the objective is to fill a 9×9
2+
Given a partially filled 9x9 2D array, the objective is to fill a 9x9
33
square grid with digits numbered 1 to 9, so that every row, column, and
4-
and each of the nine 3×3 sub-grids contains all of the digits.
4+
and each of the nine 3x3 sub-grids contains all of the digits.
55
66
This can be solved using Backtracking and is similar to n-queens.
77
We check to see if a cell is safe or not and recursively call the

bit_manipulation/single_bit_manipulation_operations.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def set_bit(number: int, position: int) -> int:
88
Set the bit at position to 1.
99
1010
Details: perform bitwise or for given number and X.
11-
Where X is a number with all the bits zeroes and bit on given
12-
position one.
11+
Where X is a number with all the bits - zeroes and bit on given
12+
position - one.
1313
1414
>>> set_bit(0b1101, 1) # 0b1111
1515
15
@@ -26,8 +26,8 @@ def clear_bit(number: int, position: int) -> int:
2626
Set the bit at position to 0.
2727
2828
Details: perform bitwise and for given number and X.
29-
Where X is a number with all the bits ones and bit on given
30-
position zero.
29+
Where X is a number with all the bits - ones and bit on given
30+
position - zero.
3131
3232
>>> clear_bit(0b10010, 1) # 0b10000
3333
16
@@ -42,8 +42,8 @@ def flip_bit(number: int, position: int) -> int:
4242
Flip the bit at position.
4343
4444
Details: perform bitwise xor for given number and X.
45-
Where X is a number with all the bits zeroes and bit on given
46-
position one.
45+
Where X is a number with all the bits - zeroes and bit on given
46+
position - one.
4747
4848
>>> flip_bit(0b101, 1) # 0b111
4949
7
@@ -79,7 +79,7 @@ def get_bit(number: int, position: int) -> int:
7979
Get the bit at the given position
8080
8181
Details: perform bitwise and for the given number and X,
82-
Where X is a number with all the bits zeroes and bit on given position one.
82+
Where X is a number with all the bits - zeroes and bit on given position - one.
8383
If the result is not equal to 0, then the bit on the given position is 1, else 0.
8484
8585
>>> get_bit(0b1010, 0)

compression/burrows_wheeler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
https://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transform
33
4-
The BurrowsWheeler transform (BWT, also called block-sorting compression)
4+
The Burrows-Wheeler transform (BWT, also called block-sorting compression)
55
rearranges a character string into runs of similar characters. This is useful
66
for compression, since it tends to be easy to compress a string that has runs
77
of repeated characters by techniques such as move-to-front transform and

compression/lempel_ziv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
One of the several implementations of LempelZivWelch compression algorithm
2+
One of the several implementations of Lempel-Ziv-Welch compression algorithm
33
https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch
44
"""
55

@@ -43,7 +43,7 @@ def add_key_to_lexicon(
4343

4444
def compress_data(data_bits: str) -> str:
4545
"""
46-
Compresses given data_bits using LempelZivWelch compression algorithm
46+
Compresses given data_bits using Lempel-Ziv-Welch compression algorithm
4747
and returns the result as a string
4848
"""
4949
lexicon = {"0": "0", "1": "1"}

compression/lempel_ziv_decompress.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
One of the several implementations of LempelZivWelch decompression algorithm
2+
One of the several implementations of Lempel-Ziv-Welch decompression algorithm
33
https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch
44
"""
55

@@ -26,7 +26,7 @@ def read_file_binary(file_path: str) -> str:
2626

2727
def decompress_data(data_bits: str) -> str:
2828
"""
29-
Decompresses given data_bits using LempelZivWelch compression algorithm
29+
Decompresses given data_bits using Lempel-Ziv-Welch compression algorithm
3030
and returns the result as a string
3131
"""
3232
lexicon = {"0": "0", "1": "1"}

computer_vision/cnn_classification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
# Importing the Keras libraries and packages
2727
import tensorflow as tf
28-
from tensorflow.keras import layers, models
28+
from keras import layers, models
2929

3030
if __name__ == "__main__":
3131
# Initialising the CNN

data_structures/arrays/sudoku_solver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def time_solve(grid):
150150
display(grid_values(grid))
151151
if values:
152152
display(values)
153-
print("(%.5f seconds)\n" % t)
153+
print(f"({t:.5f} seconds)\n")
154154
return (t, solved(values))
155155

156156
times, results = zip(*[time_solve(grid) for grid in grids])
@@ -217,4 +217,4 @@ def shuffled(seq):
217217
start = time.monotonic()
218218
solve(puzzle)
219219
t = time.monotonic() - start
220-
print("Solved: %.5f sec" % t)
220+
print(f"Solved: {t:.5f} sec")

0 commit comments

Comments
 (0)