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 — Set the Python file maximum line length to 88 characters (#2122) · jusing-es/Python@9316e7c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .travis.yml
  • arithmetic_analysis
    • intersection.py
  • backtracking
    • hamiltonian_cycle.py
    • n_queens.py
    • sum_of_subsets.py
  • blockchain
    • chinese_remainder_theorem.py
    • diophantine_equation.py
    • modular_division.py
  • ciphers
    • affine_cipher.py
    • base64_cipher.py
    • elgamal_key_generator.py
    • hill_cipher.py
    • shuffled_shift_cipher.py
  • compression
    • peak_signal_to_noise_ratio.py
  • conversions
    • decimal_to_any.py
    • decimal_to_hexadecimal.py
    • decimal_to_octal.py
  • data_structures
    • data_structures/heap
      • heap_generic.py
    • linked_list
      • skip_list.py
    • stacks
      • infix_to_prefix_conversion.py
    • trie
      • trie.py
  • digital_image_processing
    • edge_detection
      • canny.py
    • resize
      • resize.py
    • sepia.py
  • divide_and_conquer
    • convex_hull.py
  • dynamic_programming
    • fibonacci.py
    • integer_partition.py
    • iterating_through_submasks.py
    • knapsack.py
    • longest_common_subsequence.py
    • longest_sub_array.py
    • rod_cutting.py
    • subset_generation.py
    • sum_of_subset.py
  • fuzzy_logic
    • fuzzy_operations.py
  • geodesy
    • lamberts_ellipsoidal_distance.py
  • graphs
    • a_star.py
    • graphs_floyd_warshall.py
    • minimum_spanning_tree_prims.py
    • tarjans_scc.py
  • hashes
    • adler32.py
    • sdbm.py
    • sha1.py
  • machine_learning
    • gradient_descent.py
    • polymonial_regression.py
    • sequential_minimum_optimization.py
  • maths
    • bailey_borwein_plouffe.py
    • ceil.py
    • fermat_little_theorem.py
    • fibonacci.py
    • floor.py
    • gamma.py
    • greatest_common_divisor.py
    • lucas_lehmer_primality_test.py
    • matrix_exponentiation.py
    • modular_exponential.py
    • polynomial_evaluation.py
    • relu.py
    • sieve_of_eratosthenes.py
    • square_root.py
  • matrix
    • nth_fibonacci_using_matrix_exponentiation.py
    • rotate_matrix.py
    • sherman_morrison.py
    • tests
      • test_matrix_operation.py
  • other
    • dijkstra_bankers_algorithm.py
    • fischer_yates_shuffle.py
    • game_of_life.py
    • integeration_by_simpson_approx.py
    • linear_congruential_generator.py
    • nested_brackets.py
    • two_sum.py
  • project_euler
    • problem_30
      • soln.py
    • problem_56
      • sol1.py
  • scheduling
    • first_come_first_served.py
  • searches
    • linear_search.py
    • simulated_annealing.py
    • tabu_search.py
  • sorts
    • bucket_sort.py
    • comb_sort.py
    • random_normal_distribution_quicksort.py
    • unknown_sort.py
  • strings
    • boyer_moore_search.py
    • is_palindrome.py
    • jaro_winkler.py
    • knuth_morris_pratt.py
    • lower.py
    • min_cost_string_conversion.py
    • rabin_karp.py
    • split.py
    • upper.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

‎.travis.yml‎

Copy file name to clipboardExpand all lines: .travis.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ notifications:
1010
on_success: never
1111
before_script:
1212
- black --check . || true
13-
- flake8 --ignore=E203,W503 --max-complexity=25 --max-line-length=120 --statistics --count .
13+
- flake8 --ignore=E203,W503 --max-complexity=25 --max-line-length=88 --statistics --count .
1414
- scripts/validate_filenames.py # no uppercase, no spaces, in a directory
1515
- pip install -r requirements.txt # fast fail on black, flake8, validate_filenames
1616
script:
Collapse file

‎arithmetic_analysis/intersection.py‎

Copy file name to clipboardExpand all lines: arithmetic_analysis/intersection.py
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import math
22

33

4-
def intersection(
5-
function, x0, x1
6-
): # function is the f we want to find its root and x0 and x1 are two random starting points
4+
def intersection(function, x0, x1):
5+
"""
6+
function is the f we want to find its root
7+
x0 and x1 are two random starting points
8+
"""
79
x_n = x0
810
x_n1 = x1
911
while True:
Collapse file

‎backtracking/hamiltonian_cycle.py‎

Copy file name to clipboardExpand all lines: backtracking/hamiltonian_cycle.py
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def valid_connection(
1616
Checks whether it is possible to add next into path by validating 2 statements
1717
1. There should be path between current and next vertex
1818
2. Next vertex should not be in path
19-
If both validations succeeds we return true saying that it is possible to connect this vertices
20-
either we return false
19+
If both validations succeeds we return True saying that it is possible to connect
20+
this vertices either we return False
2121
2222
Case 1:Use exact graph as in main function, with initialized values
2323
>>> graph = [[0, 1, 0, 1, 0],
@@ -52,7 +52,8 @@ def util_hamilton_cycle(graph: List[List[int]], path: List[int], curr_ind: int)
5252
Pseudo-Code
5353
Base Case:
5454
1. Chceck if we visited all of vertices
55-
1.1 If last visited vertex has path to starting vertex return True either return False
55+
1.1 If last visited vertex has path to starting vertex return True either
56+
return False
5657
Recursive Step:
5758
2. Iterate over each vertex
5859
Check if next vertex is valid for transiting from current vertex
@@ -74,7 +75,8 @@ def util_hamilton_cycle(graph: List[List[int]], path: List[int], curr_ind: int)
7475
>>> print(path)
7576
[0, 1, 2, 4, 3, 0]
7677
77-
Case 2: Use exact graph as in previous case, but in the properties taken from middle of calculation
78+
Case 2: Use exact graph as in previous case, but in the properties taken from
79+
middle of calculation
7880
>>> graph = [[0, 1, 0, 1, 0],
7981
... [1, 0, 1, 1, 1],
8082
... [0, 1, 0, 0, 1],
Collapse file

‎backtracking/n_queens.py‎

Copy file name to clipboardExpand all lines: backtracking/n_queens.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
def isSafe(board, row, column):
1414
"""
15-
This function returns a boolean value True if it is safe to place a queen there considering
16-
the current state of the board.
15+
This function returns a boolean value True if it is safe to place a queen there
16+
considering the current state of the board.
1717
1818
Parameters :
1919
board(2D matrix) : board
@@ -56,8 +56,8 @@ def solve(board, row):
5656
return
5757
for i in range(len(board)):
5858
"""
59-
For every row it iterates through each column to check if it is feasible to place a
60-
queen there.
59+
For every row it iterates through each column to check if it is feasible to
60+
place a queen there.
6161
If all the combinations for that particular branch are successful the board is
6262
reinitialized for the next possible combination.
6363
"""
Collapse file

‎backtracking/sum_of_subsets.py‎

Copy file name to clipboardExpand all lines: backtracking/sum_of_subsets.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""
2-
The sum-of-subsetsproblem states that a set of non-negative integers, and a value M,
3-
determine all possible subsets of the given set whose summation sum equal to given M.
2+
The sum-of-subsetsproblem states that a set of non-negative integers, and a
3+
value M, determine all possible subsets of the given set whose summation sum
4+
equal to given M.
45
5-
Summation of the chosen numbers must be equal to given number M and one number can
6-
be used only once.
6+
Summation of the chosen numbers must be equal to given number M and one number
7+
can be used only once.
78
"""
89

910

@@ -21,7 +22,8 @@ def create_state_space_tree(nums, max_sum, num_index, path, result, remaining_nu
2122
Creates a state space tree to iterate through each branch using DFS.
2223
It terminates the branching of a node when any of the two conditions
2324
given below satisfy.
24-
This algorithm follows depth-fist-search and backtracks when the node is not branchable.
25+
This algorithm follows depth-fist-search and backtracks when the node is not
26+
branchable.
2527
2628
"""
2729
if sum(path) > max_sum or (remaining_nums_sum + sum(path)) < max_sum:
Collapse file

‎blockchain/chinese_remainder_theorem.py‎

Copy file name to clipboardExpand all lines: blockchain/chinese_remainder_theorem.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Chinese Remainder Theorem:
22
# GCD ( Greatest Common Divisor ) or HCF ( Highest Common Factor )
33

4-
# If GCD(a,b) = 1, then for any remainder ra modulo a and any remainder rb modulo b there exists integer n,
5-
# such that n = ra (mod a) and n = ra(mod b). If n1 and n2 are two such integers, then n1=n2(mod ab)
4+
# If GCD(a,b) = 1, then for any remainder ra modulo a and any remainder rb modulo b
5+
# there exists integer n, such that n = ra (mod a) and n = ra(mod b). If n1 and n2 are
6+
# two such integers, then n1=n2(mod ab)
67

78
# Algorithm :
89

Collapse file

‎blockchain/diophantine_equation.py‎

Copy file name to clipboardExpand all lines: blockchain/diophantine_equation.py
+11-7Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Diophantine Equation : Given integers a,b,c ( at least one of a and b != 0), the diophantine equation
2-
# a*x + b*y = c has a solution (where x and y are integers) iff gcd(a,b) divides c.
1+
# Diophantine Equation : Given integers a,b,c ( at least one of a and b != 0), the
2+
# diophantine equation a*x + b*y = c has a solution (where x and y are integers)
3+
# iff gcd(a,b) divides c.
34

45
# GCD ( Greatest Common Divisor ) or HCF ( Highest Common Factor )
56

@@ -29,8 +30,9 @@ def diophantine(a, b, c):
2930

3031
# Finding All solutions of Diophantine Equations:
3132

32-
# Theorem : Let gcd(a,b) = d, a = d*p, b = d*q. If (x0,y0) is a solution of Diophantine Equation a*x + b*y = c.
33-
# a*x0 + b*y0 = c, then all the solutions have the form a(x0 + t*q) + b(y0 - t*p) = c, where t is an arbitrary integer.
33+
# Theorem : Let gcd(a,b) = d, a = d*p, b = d*q. If (x0,y0) is a solution of Diophantine
34+
# Equation a*x + b*y = c. a*x0 + b*y0 = c, then all the solutions have the form
35+
# a(x0 + t*q) + b(y0 - t*p) = c, where t is an arbitrary integer.
3436

3537
# n is the number of solution you want, n = 2 by default
3638

@@ -75,8 +77,9 @@ def greatest_common_divisor(a, b):
7577
>>> greatest_common_divisor(7,5)
7678
1
7779
78-
Note : In number theory, two integers a and b are said to be relatively prime, mutually prime, or co-prime
79-
if the only positive integer (factor) that divides both of them is 1 i.e., gcd(a,b) = 1.
80+
Note : In number theory, two integers a and b are said to be relatively prime,
81+
mutually prime, or co-prime if the only positive integer (factor) that
82+
divides both of them is 1 i.e., gcd(a,b) = 1.
8083
8184
>>> greatest_common_divisor(121, 11)
8285
11
@@ -91,7 +94,8 @@ def greatest_common_divisor(a, b):
9194
return b
9295

9396

94-
# Extended Euclid's Algorithm : If d divides a and b and d = a*x + b*y for integers x and y, then d = gcd(a,b)
97+
# Extended Euclid's Algorithm : If d divides a and b and d = a*x + b*y for integers
98+
# x and y, then d = gcd(a,b)
9599

96100

97101
def extended_gcd(a, b):
Collapse file

‎blockchain/modular_division.py‎

Copy file name to clipboardExpand all lines: blockchain/modular_division.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
# GCD ( Greatest Common Divisor ) or HCF ( Highest Common Factor )
55

6-
# Given three integers a, b, and n, such that gcd(a,n)=1 and n>1, the algorithm should return an integer x such that
7-
# 0≤x≤n−1, and b/a=x(modn) (that is, b=ax(modn)).
6+
# Given three integers a, b, and n, such that gcd(a,n)=1 and n>1, the algorithm should
7+
# return an integer x such that 0≤x≤n−1, and b/a=x(modn) (that is, b=ax(modn)).
88

99
# Theorem:
1010
# a has a multiplicative inverse modulo n iff gcd(a,n) = 1
@@ -68,7 +68,8 @@ def modular_division2(a, b, n):
6868
return x
6969

7070

71-
# Extended Euclid's Algorithm : If d divides a and b and d = a*x + b*y for integers x and y, then d = gcd(a,b)
71+
# Extended Euclid's Algorithm : If d divides a and b and d = a*x + b*y for integers x
72+
# and y, then d = gcd(a,b)
7273

7374

7475
def extended_gcd(a, b):
@@ -123,8 +124,9 @@ def greatest_common_divisor(a, b):
123124
>>> greatest_common_divisor(7,5)
124125
1
125126
126-
Note : In number theory, two integers a and b are said to be relatively prime, mutually prime, or co-prime
127-
if the only positive integer (factor) that divides both of them is 1 i.e., gcd(a,b) = 1.
127+
Note : In number theory, two integers a and b are said to be relatively prime,
128+
mutually prime, or co-prime if the only positive integer (factor) that divides
129+
both of them is 1 i.e., gcd(a,b) = 1.
128130
129131
>>> greatest_common_divisor(121, 11)
130132
11
Collapse file

‎ciphers/affine_cipher.py‎

Copy file name to clipboardExpand all lines: ciphers/affine_cipher.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def check_keys(keyA, keyB, mode):
5555

5656
def encrypt_message(key: int, message: str) -> str:
5757
"""
58-
>>> encrypt_message(4545, 'The affine cipher is a type of monoalphabetic substitution cipher.')
58+
>>> encrypt_message(4545, 'The affine cipher is a type of monoalphabetic '
59+
... 'substitution cipher.')
5960
'VL}p MM{I}p~{HL}Gp{vp pFsH}pxMpyxIx JHL O}F{~pvuOvF{FuF{xIp~{HL}Gi'
6061
"""
6162
keyA, keyB = divmod(key, len(SYMBOLS))
@@ -72,7 +73,8 @@ def encrypt_message(key: int, message: str) -> str:
7273

7374
def decrypt_message(key: int, message: str) -> str:
7475
"""
75-
>>> decrypt_message(4545, 'VL}p MM{I}p~{HL}Gp{vp pFsH}pxMpyxIx JHL O}F{~pvuOvF{FuF{xIp~{HL}Gi')
76+
>>> decrypt_message(4545, 'VL}p MM{I}p~{HL}Gp{vp pFsH}pxMpyxIx JHL O}F{~pvuOvF{FuF'
77+
... '{xIp~{HL}Gi')
7678
'The affine cipher is a type of monoalphabetic substitution cipher.'
7779
"""
7880
keyA, keyB = divmod(key, len(SYMBOLS))
Collapse file

‎ciphers/base64_cipher.py‎

Copy file name to clipboardExpand all lines: ciphers/base64_cipher.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def decode_base64(text):
3939
'WELCOME to base64 encoding 😁'
4040
>>> decode_base64('QcOF4ZCD8JCAj/CfpJM=')
4141
'AÅᐃ𐀏🤓'
42-
>>> decode_base64("QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB\r\nQUFB")
42+
>>> decode_base64("QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUF"
43+
... "BQUFBQUFBQUFB\r\nQUFB")
4344
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
4445
"""
4546
base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

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.