Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)

* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038)

* refactor: Fix naming conventions (#7038)

* Update arithmetic_analysis/lu_decomposition.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038)

* chore: Fix naming conventions in doctests (#7038)

* fix: Temporarily disable project euler problem 104 (#7069)

* chore: Fix naming conventions in doctests (#7038)

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Caeden
2022-10-12 23:54:20 +01:00
committed by GitHub
parent e2cd982b11
commit 07e991d553
140 changed files with 1552 additions and 1536 deletions

View File

@ -41,13 +41,13 @@ class BoyerMooreSearch:
return i
return -1
def mismatch_in_text(self, currentPos: int) -> int:
def mismatch_in_text(self, current_pos: int) -> int:
"""
find the index of mis-matched character in text when compared with pattern
from last
Parameters :
currentPos (int): current index position of text
current_pos (int): current index position of text
Returns :
i (int): index of mismatched char from last in text
@ -55,8 +55,8 @@ class BoyerMooreSearch:
"""
for i in range(self.patLen - 1, -1, -1):
if self.pattern[i] != self.text[currentPos + i]:
return currentPos + i
if self.pattern[i] != self.text[current_pos + i]:
return current_pos + i
return -1
def bad_character_heuristic(self) -> list[int]:

View File

@ -67,12 +67,12 @@ def can_string_be_rearranged_as_palindrome(input_str: str = "") -> bool:
Step 2:If we find more than 1 character that appears odd number of times,
It is not possible to rearrange as a palindrome
"""
oddChar = 0
odd_char = 0
for character_count in character_freq_dict.values():
if character_count % 2:
oddChar += 1
if oddChar > 1:
odd_char += 1
if odd_char > 1:
return False
return True

View File

@ -48,8 +48,8 @@ if __name__ == "__main__":
from doctest import testmod
testmod()
input_A = input("Enter the first string ").strip()
input_B = input("Enter the second string ").strip()
input_a = input("Enter the first string ").strip()
input_b = input("Enter the second string ").strip()
status = check_anagrams(input_A, input_B)
print(f"{input_A} and {input_B} are {'' if status else 'not '}anagrams.")
status = check_anagrams(input_a, input_b)
print(f"{input_a} and {input_b} are {'' if status else 'not '}anagrams.")

View File

@ -26,10 +26,10 @@ if __name__ == "__main__":
start_time = time.time()
with open("dictionary.txt") as in_file:
wordList = in_file.read().splitlines()
word_list = in_file.read().splitlines()
all_patterns: dict = {}
for word in wordList:
for word in word_list:
pattern = get_word_pattern(word)
if pattern in all_patterns:
all_patterns[pattern].append(word)
@ -39,6 +39,6 @@ if __name__ == "__main__":
with open("word_patterns.txt", "w") as out_file:
out_file.write(pprint.pformat(all_patterns))
totalTime = round(time.time() - start_time, 2)
print(f"Done! {len(all_patterns):,} word patterns found in {totalTime} seconds.")
total_time = round(time.time() - start_time, 2)
print(f"Done! {len(all_patterns):,} word patterns found in {total_time} seconds.")
# Done! 9,581 word patterns found in 0.58 seconds.