Skip to content

Fix indentation contains tabs (flake8 E101,W191) #1573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before_install: pip install --upgrade pip setuptools
install: pip install -r requirements.txt
before_script:
- black --check . || true
- flake8 . --count --select=E9,F4,F63,F7,F82 --show-source --statistics
- flake8 . --count --select=E101,E9,F4,F63,F7,F82,W191 --show-source --statistics
script:
- scripts/validate_filenames.py # no uppercase, no spaces, in a directory
- mypy --ignore-missing-imports .
Expand Down
6 changes: 3 additions & 3 deletions backtracking/all_combinations.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

"""
In this problem, we want to determine all possible combinations of k
numbers out of 1 ... n. We use backtracking to solve this problem.
Time complexity: O(C(n,k)) which is O(n choose k) = O((n!/(k! * (n - k)!)))
In this problem, we want to determine all possible combinations of k
numbers out of 1 ... n. We use backtracking to solve this problem.
Time complexity: O(C(n,k)) which is O(n choose k) = O((n!/(k! * (n - k)!)))
"""


Expand Down
18 changes: 9 additions & 9 deletions backtracking/all_permutations.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
In this problem, we want to determine all possible permutations
of the given sequence. We use backtracking to solve this problem.
In this problem, we want to determine all possible permutations
of the given sequence. We use backtracking to solve this problem.

Time complexity: O(n! * n),
where n denotes the length of the given sequence.
Time complexity: O(n! * n),
where n denotes the length of the given sequence.
"""


Expand All @@ -13,10 +13,10 @@ def generate_all_permutations(sequence):

def create_state_space_tree(sequence, current_sequence, index, index_used):
"""
Creates a state space tree to iterate through each branch using DFS.
We know that each state has exactly len(sequence) - index children.
It terminates when it reaches the end of the given sequence.
"""
Creates a state space tree to iterate through each branch using DFS.
We know that each state has exactly len(sequence) - index children.
It terminates when it reaches the end of the given sequence.
"""

if index == len(sequence):
print(current_sequence)
Expand All @@ -32,7 +32,7 @@ def create_state_space_tree(sequence, current_sequence, index, index_used):


"""
remove the comment to take an input from the user
remove the comment to take an input from the user

print("Enter the elements")
sequence = list(map(int, input().split()))
Expand Down
18 changes: 9 additions & 9 deletions backtracking/all_subsequences.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
In this problem, we want to determine all possible subsequences
of the given sequence. We use backtracking to solve this problem.
In this problem, we want to determine all possible subsequences
of the given sequence. We use backtracking to solve this problem.

Time complexity: O(2^n),
where n denotes the length of the given sequence.
Time complexity: O(2^n),
where n denotes the length of the given sequence.
"""


Expand All @@ -13,10 +13,10 @@ def generate_all_subsequences(sequence):

def create_state_space_tree(sequence, current_subsequence, index):
"""
Creates a state space tree to iterate through each branch using DFS.
We know that each state has exactly two children.
It terminates when it reaches the end of the given sequence.
"""
Creates a state space tree to iterate through each branch using DFS.
We know that each state has exactly two children.
It terminates when it reaches the end of the given sequence.
"""

if index == len(sequence):
print(current_subsequence)
Expand All @@ -29,7 +29,7 @@ def create_state_space_tree(sequence, current_subsequence, index):


"""
remove the comment to take an input from the user
remove the comment to take an input from the user

print("Enter the elements")
sequence = list(map(int, input().split()))
Expand Down
20 changes: 10 additions & 10 deletions backtracking/sum_of_subsets.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
The sum-of-subsetsproblem states that a set of non-negative integers, and a value M,
determine all possible subsets of the given set whose summation sum equal to given M.
The sum-of-subsetsproblem states that a set of non-negative integers, and a value M,
determine all possible subsets of the given set whose summation sum equal to given M.

Summation of the chosen numbers must be equal to given number M and one number can
be used only once.
Summation of the chosen numbers must be equal to given number M and one number can
be used only once.
"""


Expand All @@ -18,12 +18,12 @@ def generate_sum_of_subsets_soln(nums, max_sum):

def create_state_space_tree(nums, max_sum, num_index, path, result, remaining_nums_sum):
"""
Creates a state space tree to iterate through each branch using DFS.
It terminates the branching of a node when any of the two conditions
given below satisfy.
This algorithm follows depth-fist-search and backtracks when the node is not branchable.
Creates a state space tree to iterate through each branch using DFS.
It terminates the branching of a node when any of the two conditions
given below satisfy.
This algorithm follows depth-fist-search and backtracks when the node is not branchable.

"""
"""
if sum(path) > max_sum or (remaining_nums_sum + sum(path)) < max_sum:
return
if sum(path) == max_sum:
Expand All @@ -41,7 +41,7 @@ def create_state_space_tree(nums, max_sum, num_index, path, result, remaining_nu


"""
remove the comment to take an input from the user
remove the comment to take an input from the user

print("Enter the elements")
nums = list(map(int, input().split()))
Expand Down
54 changes: 27 additions & 27 deletions boolean_algebra/quine_mc_cluskey.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
def compare_string(string1, string2):
"""
>>> compare_string('0010','0110')
'0_10'
>>> compare_string('0110','1101')
-1
"""
>>> compare_string('0010','0110')
'0_10'

>>> compare_string('0110','1101')
-1
"""
l1 = list(string1)
l2 = list(string2)
count = 0
Expand All @@ -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)
Expand All @@ -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:
Expand All @@ -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('01_','001',1)
False
"""
>>> is_for_table('__1','011',2)
True

>>> is_for_table('01_','001',1)
False
"""
l1 = list(string1)
l2 = list(string2)
count_n = 0
Expand All @@ -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])):
Expand Down Expand Up @@ -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("_")
Expand Down
Loading