Fix invalid escape sequence in binary_search_tree.py (#1920)

* Fix invalid escape sequence in binary_search_tree.py

data_structures/binary_tree/binary_search_tree.py:156
  /home/travis/build/TheAlgorithms/Python/data_structures/binary_tree/binary_search_tree.py:156: DeprecationWarning: invalid escape sequence \

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Christian Clauss 2020-04-30 22:47:11 +02:00 committed by GitHub
parent 3d0680eddf
commit 1ad78b2663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,7 @@ https://www.dcode.fr/letter-number-cipher
http://bestcodes.weebly.com/a1z26.html http://bestcodes.weebly.com/a1z26.html
""" """
def encode(plain: str) -> list: def encode(plain: str) -> list:
""" """
>>> encode("myname") >>> encode("myname")
@ -13,6 +14,7 @@ def encode(plain: str) -> list:
""" """
return [ord(elem) - 96 for elem in plain] return [ord(elem) - 96 for elem in plain]
def decode(encoded: list) -> str: def decode(encoded: list) -> str:
""" """
>>> decode([13, 25, 14, 1, 13, 5]) >>> decode([13, 25, 14, 1, 13, 5])
@ -20,10 +22,12 @@ def decode(encoded: list) -> str:
""" """
return "".join(chr(elem + 96) for elem in encoded) return "".join(chr(elem + 96) for elem in encoded)
def main(): def main():
encoded = encode(input("->").strip().lower()) encoded = encode(input("->").strip().lower())
print("Encoded: ", encoded) print("Encoded: ", encoded)
print("Decoded:", decode(encoded)) print("Decoded:", decode(encoded))
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@ -153,7 +153,7 @@ def postorder(curr_node):
def binary_search_tree(): def binary_search_tree():
""" r"""
Example Example
8 8
/ \ / \

View File

@ -78,7 +78,7 @@ def test_sepia():
assert sepia.all() assert sepia.all()
def test_burkes(file_path: str="digital_image_processing/image_data/lena_small.jpg"): def test_burkes(file_path: str = "digital_image_processing/image_data/lena_small.jpg"):
burkes = bs.Burkes(imread(file_path, 1), 120) burkes = bs.Burkes(imread(file_path, 1), 120)
burkes.process() burkes.process()
assert burkes.output_img.any() assert burkes.output_img.any()