From ec7bc7c7cde95afbc8a7d7f826358cc221edfb6b Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 21 Nov 2019 15:21:40 +0100 Subject: [PATCH] Tabs --> spaces in quine_mc_cluskey.py (#1426) * Tabs --> spaces in quine_mc_cluskey.py * fixup! Format Python code with psf/black push --- boolean_algebra/quine_mc_cluskey.py | 48 +++++++++---------- data_structures/queue/circular_queue.py | 5 +- .../filters/gaussian_filter.py | 8 ++-- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/boolean_algebra/quine_mc_cluskey.py b/boolean_algebra/quine_mc_cluskey.py index a066982e5..036cfbe63 100644 --- a/boolean_algebra/quine_mc_cluskey.py +++ b/boolean_algebra/quine_mc_cluskey.py @@ -1,11 +1,11 @@ def compare_string(string1, string2): """ - >>> compare_string('0010','0110') - '0_10' + >>> compare_string('0010','0110') + '0_10' - >>> compare_string('0110','1101') - -1 - """ + >>> compare_string('0110','1101') + -1 + """ l1 = list(string1) l2 = list(string2) count = 0 @@ -21,9 +21,9 @@ def compare_string(string1, string2): def check(binary): """ - >>> check(['0.00.01.5']) - ['0.00.01.5'] - """ + >>> check(['0.00.01.5']) + ['0.00.01.5'] + """ pi = [] while 1: check1 = ["$"] * len(binary) @@ -45,9 +45,9 @@ def check(binary): def decimal_to_binary(no_of_variable, minterms): """ - >>> decimal_to_binary(3,[1.5]) - ['0.00.01.5'] - """ + >>> decimal_to_binary(3,[1.5]) + ['0.00.01.5'] + """ temp = [] s = "" for m in minterms: @@ -61,12 +61,12 @@ def decimal_to_binary(no_of_variable, minterms): def is_for_table(string1, string2, count): """ - >>> is_for_table('__1','011',2) - True + >>> is_for_table('__1','011',2) + True - >>> is_for_table('01_','001',1) - False - """ + >>> is_for_table('01_','001',1) + False + """ l1 = list(string1) l2 = list(string2) count_n = 0 @@ -81,12 +81,12 @@ def is_for_table(string1, string2, count): def selection(chart, prime_implicants): """ - >>> selection([[1]],['0.00.01.5']) - ['0.00.01.5'] + >>> selection([[1]],['0.00.01.5']) + ['0.00.01.5'] - >>> selection([[1]],['0.00.01.5']) - ['0.00.01.5'] - """ + >>> selection([[1]],['0.00.01.5']) + ['0.00.01.5'] + """ temp = [] select = [0] * len(chart) for i in range(len(chart[0])): @@ -128,9 +128,9 @@ def selection(chart, prime_implicants): def prime_implicant_chart(prime_implicants, binary): """ - >>> prime_implicant_chart(['0.00.01.5'],['0.00.01.5']) - [[1]] - """ + >>> prime_implicant_chart(['0.00.01.5'],['0.00.01.5']) + [[1]] + """ chart = [[0 for x in range(len(binary))] for x in range(len(prime_implicants))] for i in range(len(prime_implicants)): count = prime_implicants[i].count("_") diff --git a/data_structures/queue/circular_queue.py b/data_structures/queue/circular_queue.py index 2ba3f891e..229a67ebb 100644 --- a/data_structures/queue/circular_queue.py +++ b/data_structures/queue/circular_queue.py @@ -1,5 +1,6 @@ # Implementation of Circular Queue (using Python lists) + class CircularQueue: """Circular FIFO queue with a fixed capacity""" @@ -59,7 +60,7 @@ class CircularQueue: raise Exception("QUEUE IS FULL") self.array[self.rear] = data - self.rear = (self.rear+1)%self.n + self.rear = (self.rear + 1) % self.n self.size += 1 return self @@ -88,6 +89,6 @@ class CircularQueue: temp = self.array[self.front] self.array[self.front] = None - self.front = (self.front + 1)%self.n + self.front = (self.front + 1) % self.n self.size -= 1 return temp diff --git a/digital_image_processing/filters/gaussian_filter.py b/digital_image_processing/filters/gaussian_filter.py index b5e2ac00d..79026ddcc 100644 --- a/digital_image_processing/filters/gaussian_filter.py +++ b/digital_image_processing/filters/gaussian_filter.py @@ -22,10 +22,10 @@ def gaussian_filter(image, k_size, sigma): # im2col, turn the k_size*k_size pixels into a row and np.vstack all rows image_array = zeros((dst_height * dst_width, k_size * k_size)) row = 0 - for i, j in product(range(dst_height), range(dst_width)): - window = ravel(image[i : i + k_size, j : j + k_size]) - image_array[row, :] = window - row += 1 + for i, j in product(range(dst_height), range(dst_width)): + window = ravel(image[i : i + k_size, j : j + k_size]) + image_array[row, :] = window + row += 1 # turn the kernel into shape(k*k, 1) gaussian_kernel = gen_gaussian_kernel(k_size, sigma)