Skip to content

Commit ec7bc7c

Browse files
cclausspoyea
authored andcommitted
Tabs --> spaces in quine_mc_cluskey.py (TheAlgorithms#1426)
* Tabs --> spaces in quine_mc_cluskey.py * fixup! Format Python code with psf/black push
1 parent e8aa812 commit ec7bc7c

File tree

3 files changed

+31
-30
lines changed

3 files changed

+31
-30
lines changed

boolean_algebra/quine_mc_cluskey.py

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
def compare_string(string1, string2):
22
"""
3-
>>> compare_string('0010','0110')
4-
'0_10'
3+
>>> compare_string('0010','0110')
4+
'0_10'
55
6-
>>> compare_string('0110','1101')
7-
-1
8-
"""
6+
>>> compare_string('0110','1101')
7+
-1
8+
"""
99
l1 = list(string1)
1010
l2 = list(string2)
1111
count = 0
@@ -21,9 +21,9 @@ def compare_string(string1, string2):
2121

2222
def check(binary):
2323
"""
24-
>>> check(['0.00.01.5'])
25-
['0.00.01.5']
26-
"""
24+
>>> check(['0.00.01.5'])
25+
['0.00.01.5']
26+
"""
2727
pi = []
2828
while 1:
2929
check1 = ["$"] * len(binary)
@@ -45,9 +45,9 @@ def check(binary):
4545

4646
def decimal_to_binary(no_of_variable, minterms):
4747
"""
48-
>>> decimal_to_binary(3,[1.5])
49-
['0.00.01.5']
50-
"""
48+
>>> decimal_to_binary(3,[1.5])
49+
['0.00.01.5']
50+
"""
5151
temp = []
5252
s = ""
5353
for m in minterms:
@@ -61,12 +61,12 @@ def decimal_to_binary(no_of_variable, minterms):
6161

6262
def is_for_table(string1, string2, count):
6363
"""
64-
>>> is_for_table('__1','011',2)
65-
True
64+
>>> is_for_table('__1','011',2)
65+
True
6666
67-
>>> is_for_table('01_','001',1)
68-
False
69-
"""
67+
>>> is_for_table('01_','001',1)
68+
False
69+
"""
7070
l1 = list(string1)
7171
l2 = list(string2)
7272
count_n = 0
@@ -81,12 +81,12 @@ def is_for_table(string1, string2, count):
8181

8282
def selection(chart, prime_implicants):
8383
"""
84-
>>> selection([[1]],['0.00.01.5'])
85-
['0.00.01.5']
84+
>>> selection([[1]],['0.00.01.5'])
85+
['0.00.01.5']
8686
87-
>>> selection([[1]],['0.00.01.5'])
88-
['0.00.01.5']
89-
"""
87+
>>> selection([[1]],['0.00.01.5'])
88+
['0.00.01.5']
89+
"""
9090
temp = []
9191
select = [0] * len(chart)
9292
for i in range(len(chart[0])):
@@ -128,9 +128,9 @@ def selection(chart, prime_implicants):
128128

129129
def prime_implicant_chart(prime_implicants, binary):
130130
"""
131-
>>> prime_implicant_chart(['0.00.01.5'],['0.00.01.5'])
132-
[[1]]
133-
"""
131+
>>> prime_implicant_chart(['0.00.01.5'],['0.00.01.5'])
132+
[[1]]
133+
"""
134134
chart = [[0 for x in range(len(binary))] for x in range(len(prime_implicants))]
135135
for i in range(len(prime_implicants)):
136136
count = prime_implicants[i].count("_")

data_structures/queue/circular_queue.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Implementation of Circular Queue (using Python lists)
22

3+
34
class CircularQueue:
45
"""Circular FIFO queue with a fixed capacity"""
56

@@ -59,7 +60,7 @@ def enqueue(self, data):
5960
raise Exception("QUEUE IS FULL")
6061

6162
self.array[self.rear] = data
62-
self.rear = (self.rear+1)%self.n
63+
self.rear = (self.rear + 1) % self.n
6364
self.size += 1
6465
return self
6566

@@ -88,6 +89,6 @@ def dequeue(self):
8889

8990
temp = self.array[self.front]
9091
self.array[self.front] = None
91-
self.front = (self.front + 1)%self.n
92+
self.front = (self.front + 1) % self.n
9293
self.size -= 1
9394
return temp

digital_image_processing/filters/gaussian_filter.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def gaussian_filter(image, k_size, sigma):
2222
# im2col, turn the k_size*k_size pixels into a row and np.vstack all rows
2323
image_array = zeros((dst_height * dst_width, k_size * k_size))
2424
row = 0
25-
for i, j in product(range(dst_height), range(dst_width)):
26-
window = ravel(image[i : i + k_size, j : j + k_size])
27-
image_array[row, :] = window
28-
row += 1
25+
for i, j in product(range(dst_height), range(dst_width)):
26+
window = ravel(image[i : i + k_size, j : j + k_size])
27+
image_array[row, :] = window
28+
row += 1
2929

3030
# turn the kernel into shape(k*k, 1)
3131
gaussian_kernel = gen_gaussian_kernel(k_size, sigma)

0 commit comments

Comments
 (0)