GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pyupgrade --py37-plus **/*.py (#1654) · SharathKumarGithub/Python@28419cf

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • backtracking
    • all_combinations.py
  • ciphers
    • brute_force_caesar_cipher.py
    • hill_cipher.py
    • rsa_cipher.py
    • rsa_key_generator.py
    • shuffled_shift_cipher.py
    • simple_substitution_cipher.py
    • xor_cipher.py
  • compression
    • burrows_wheeler.py
  • data_structures
    • binary_tree
      • avl_tree.py
      • red_black_tree.py
      • treap.py
    • data_structures/heap
      • heap_generic.py
    • hashing
      • hash_table.py
    • stacks
      • stack.py
  • digital_image_processing
    • histogram_equalization
      • histogram_stretch.py
    • index_calculation.py
  • dynamic_programming
    • fast_fibonacci.py
    • k_means_clustering_tensorflow.py
    • matrix_chain_order.py
  • graphs
    • basic_graphs.py
    • breadth_first_search.py
    • depth_first_search.py
    • edmonds_karp_multiple_source_and_sink.py
    • graph_list.py
  • hashes
    • hamming_code.py
  • linear_algebra/src
    • lib.py
    • test_linear_algebra.py
  • machine_learning
    • k_means_clust.py
    • logistic_regression.py
    • sequential_minimum_optimization.py
  • maths
    • 3n+1.py
    • __init__.py
    • hardy_ramanujanalgo.py
    • lucas_lehmer_primality_test.py
    • matrix_exponentiation.py
    • newton_raphson.py
    • pythagoras.py
    • sieve_of_eratosthenes.py
  • matrix
    • matrix_operation.py
    • rotate_matrix.py
    • searching_in_sorted_matrix.py
    • sherman_morrison.py
  • neural_network
    • back_propagation_neural_network.py
    • convolution_neural_network.py
    • input_data.py
  • other
    • anagrams.py
    • fischer_yates_shuffle.py
    • linear_congruential_generator.py
    • primelib.py
    • sierpinski_triangle.py
  • project_euler
    • problem_06
      • sol1.py
      • sol2.py
      • sol3.py
      • sol4.py
    • problem_07
      • sol1.py
      • sol2.py
      • sol3.py
    • problem_08
      • sol1.py
      • sol2.py
      • sol3.py
    • problem_14
      • sol1.py
      • sol2.py
    • problem_21
      • sol1.py
    • problem_22
      • sol1.py
      • sol2.py
    • problem_25
      • sol1.py
      • sol2.py
      • sol3.py
    • problem_31
      • sol1.py
    • problem_32
      • sol32.py
    • problem_33
      • __init__.py
      • sol1.py
    • problem_40
      • sol1.py
    • problem_53
      • sol1.py
  • sorts
    • external_sort.py
  • strings
    • aho-corasick.py

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎backtracking/all_combinations.py‎

Copy file name to clipboardExpand all lines: backtracking/all_combinations.py
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
"""
42
In this problem, we want to determine all possible combinations of k
53
numbers out of 1 ... n. We use backtracking to solve this problem.
Collapse file

‎ciphers/brute_force_caesar_cipher.py‎

Copy file name to clipboardExpand all lines: ciphers/brute_force_caesar_cipher.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def decrypt(message):
4040
translated = translated + LETTERS[num]
4141
else:
4242
translated = translated + symbol
43-
print("Decryption using Key #%s: %s" % (key, translated))
43+
print(f"Decryption using Key #{key}: {translated}")
4444

4545

4646
def main():
Collapse file

‎ciphers/hill_cipher.py‎

Copy file name to clipboardExpand all lines: ciphers/hill_cipher.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def checkDeterminant(self):
7878
req_l = len(self.key_string)
7979
if gcd(det, len(self.key_string)) != 1:
8080
raise ValueError(
81-
"discriminant modular {0} of encryption key({1}) is not co prime w.r.t {2}.\nTry another key.".format(
81+
"discriminant modular {} of encryption key({}) is not co prime w.r.t {}.\nTry another key.".format(
8282
req_l, det, req_l
8383
)
8484
)
Collapse file

‎ciphers/rsa_cipher.py‎

Copy file name to clipboardExpand all lines: ciphers/rsa_cipher.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def encryptAndWriteToFile(
101101
for i in range(len(encryptedBlocks)):
102102
encryptedBlocks[i] = str(encryptedBlocks[i])
103103
encryptedContent = ",".join(encryptedBlocks)
104-
encryptedContent = "%s_%s_%s" % (len(message), blockSize, encryptedContent)
104+
encryptedContent = "{}_{}_{}".format(len(message), blockSize, encryptedContent)
105105
with open(messageFilename, "w") as fo:
106106
fo.write(encryptedContent)
107107
return encryptedContent
Collapse file

‎ciphers/rsa_key_generator.py‎

Copy file name to clipboardExpand all lines: ciphers/rsa_key_generator.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ def makeKeyFiles(name, keySize):
4343
publicKey, privateKey = generateKey(keySize)
4444
print("\nWriting public key to file %s_pubkey.txt..." % name)
4545
with open("%s_pubkey.txt" % name, "w") as fo:
46-
fo.write("%s,%s,%s" % (keySize, publicKey[0], publicKey[1]))
46+
fo.write("{},{},{}".format(keySize, publicKey[0], publicKey[1]))
4747

4848
print("Writing private key to file %s_privkey.txt..." % name)
4949
with open("%s_privkey.txt" % name, "w") as fo:
50-
fo.write("%s,%s,%s" % (keySize, privateKey[0], privateKey[1]))
50+
fo.write("{},{},{}".format(keySize, privateKey[0], privateKey[1]))
5151

5252

5353
if __name__ == "__main__":
Collapse file

‎ciphers/shuffled_shift_cipher.py‎

Copy file name to clipboardExpand all lines: ciphers/shuffled_shift_cipher.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import string
33

44

5-
class ShuffledShiftCipher(object):
5+
class ShuffledShiftCipher:
66
"""
77
This algorithm uses the Caesar Cipher algorithm but removes the option to
88
use brute force to decrypt the message.
Collapse file

‎ciphers/simple_substitution_cipher.py‎

Copy file name to clipboardExpand all lines: ciphers/simple_substitution_cipher.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def main():
1717
mode = "decrypt"
1818
translated = decryptMessage(key, message)
1919

20-
print("\n%sion: \n%s" % (mode.title(), translated))
20+
print("\n{}ion: \n{}".format(mode.title(), translated))
2121

2222

2323
def checkValidKey(key):
Collapse file

‎ciphers/xor_cipher.py‎

Copy file name to clipboardExpand all lines: ciphers/xor_cipher.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"""
1919

2020

21-
class XORCipher(object):
21+
class XORCipher:
2222
def __init__(self, key=0):
2323
"""
2424
simple constructor that receives a key or uses
Collapse file

‎compression/burrows_wheeler.py‎

Copy file name to clipboardExpand all lines: compression/burrows_wheeler.py
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,14 @@ def reverse_bwt(bwt_string: str, idx_original_string: int) -> str:
135135
idx_original_string = int(idx_original_string)
136136
except ValueError:
137137
raise TypeError(
138-
(
139-
"The parameter idx_original_string type must be int or passive"
140-
" of cast to int."
141-
)
138+
"The parameter idx_original_string type must be int or passive"
139+
" of cast to int."
142140
)
143141
if idx_original_string < 0:
144142
raise ValueError("The parameter idx_original_string must not be lower than 0.")
145143
if idx_original_string >= len(bwt_string):
146144
raise ValueError(
147-
("The parameter idx_original_string must be lower than" " len(bwt_string).")
145+
"The parameter idx_original_string must be lower than" " len(bwt_string)."
148146
)
149147

150148
ordered_rotations = [""] * len(bwt_string)
Collapse file

‎data_structures/binary_tree/avl_tree.py‎

Copy file name to clipboardExpand all lines: data_structures/binary_tree/avl_tree.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
An auto-balanced binary tree!
43
"""

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.