Skip to content

Add autoDIR Action #1546

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

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ae791f0
Merge pull request #1 from TheAlgorithms/master
mrvnmchm Aug 17, 2019
ae675f0
Merge pull request #2 from TheAlgorithms/master
mrvnmchm Sep 13, 2019
32f1435
Merge pull request #3 from TheAlgorithms/master
mrvnmchm Oct 3, 2019
670f700
Merge pull request #4 from TheAlgorithms/master
mrvnmchm Oct 30, 2019
8c6574f
travis test
mrvnmchm Oct 30, 2019
cc55035
travis pull ID test
mrvnmchm Oct 31, 2019
5f12b5f
get pr branch test
mrvnmchm Oct 31, 2019
59145de
Merge branch 'master' into travis-test
mrvnmchm Oct 31, 2019
17d19d7
Merge pull request #5 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
abbf642
retry pr build
mrvnmchm Oct 31, 2019
22a12c9
test pushing back - probable git error for origin 'not found'
mrvnmchm Oct 31, 2019
654c99f
Merge pull request #6 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
c463129
github auth?
mrvnmchm Oct 31, 2019
3ec0c04
Merge pull request #7 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
6391d72
add .sh
mrvnmchm Oct 31, 2019
b5f7305
chmod
mrvnmchm Oct 31, 2019
916970f
Merge pull request #8 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
ac50a2c
add index update for permission fix
mrvnmchm Oct 31, 2019
0cb7bf9
Merge pull request #9 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
938b395
Merge pull request #10 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
d895a00
run sh for script
mrvnmchm Oct 31, 2019
0ac923e
add all
mrvnmchm Oct 31, 2019
5e63965
Merge pull request #11 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
4322e39
Merge pull request #12 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
bbe8bd3
add pull directory
mrvnmchm Oct 31, 2019
184585c
Merge pull request #13 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
dd4dd4e
fetch pr branch
mrvnmchm Oct 31, 2019
78b7dab
swap placement of adding commits
mrvnmchm Oct 31, 2019
b0eaef3
Merge pull request #15 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
92df8b9
rotate
mrvnmchm Oct 31, 2019
bb63b2f
quit trying to update Travis
mrvnmchm Oct 31, 2019
6a9e608
Merge pull request #16 from mrvnmchm/travis-test
mrvnmchm Oct 31, 2019
6c39148
Merge pull request #17 from TheAlgorithms/master
mrvnmchm Oct 31, 2019
b28fdf6
formatting leftovers
mrvnmchm Oct 31, 2019
a5233f9
testing out init action
mrvnmchm Nov 1, 2019
d0ad618
fixup: Format Python code with psf/black
cclauss Nov 1, 2019
8bd4163
fix action typo - missing underscore in trigger
mrvnmchm Nov 1, 2019
75edd88
Merge branch 'action-test' of https://github.com/mrvnmchm/Python-1 in…
mrvnmchm Nov 1, 2019
0da1e27
add push to git
mrvnmchm Nov 1, 2019
4cc8013
Update: DIRECTORY.md
mrvnmchm Nov 1, 2019
c196387
one step
mrvnmchm Nov 1, 2019
c3316ef
Merge branch 'action-test' of https://github.com/mrvnmchm/Python-1 in…
mrvnmchm Nov 1, 2019
9298709
add, add
mrvnmchm Nov 1, 2019
c1fa134
conditional pushing
mrvnmchm Nov 1, 2019
717a62c
fix multiple runs
mrvnmchm Nov 1, 2019
70ade0e
clean exit
mrvnmchm Nov 1, 2019
126b3a4
Travis CI: Write & print DIRECTORY.md on one line
cclauss Nov 1, 2019
c3d70ae
check before commit
mrvnmchm Nov 1, 2019
161b692
reverse order
mrvnmchm Nov 1, 2019
10d6487
Merge pull request #18 from mrvnmchm/action-test
mrvnmchm Nov 1, 2019
8962484
Merge pull request #19 from TheAlgorithms/master
mrvnmchm Nov 1, 2019
06c4abb
Merge pull request #21 from TheAlgorithms/master
mrvnmchm Nov 1, 2019
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
29 changes: 29 additions & 0 deletions .github/workflows/autoDIR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: autoDIR
Copy link
Member

@cclauss cclauss Nov 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment and change the name:

# The objective of this GitHub Action is to add a new DIRECTORY.md file to a pull request if needed.
name: directory_writer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make this change for the upcoming PR

on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [3.7]
steps:

- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Update DIRECTORY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name: Update DIRECTORY.md

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will make this change in upcoming PR

run: |
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
git config --global user.name 'autoDIR'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directory_writer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will make this change in upcoming PR

git config --global user.email 'mrvnmchm@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.gh_token }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git diff-files --quiet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that if this command fails then the entire PR is marked with a failing test ❌ which we do not want.

On line 28, use fixup: instead of Update: because when a merge happens git will autosquish that commit into the previous commit.

Put a \n at the end of the file so that GitHub does not put 🚫 at the end of the file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct @cclauss, the git diff-files --quiet commands exit code is the same as for git diff-index (0 == no differences; 1 == differences). In this case, if failure, it will continue with the push. Would you have any suggestion for evaluating if the DIRECTORY.md file has changed?

I will make the changes to line 28, and add the newline at the end in upcoming PR

- name: Push DIRECTORY
if: failure()
run: |
git commit -am "Update: DIRECTORY.md"
git push
22 changes: 22 additions & 0 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* [Newton Forward Interpolation](https://github.com/TheAlgorithms/Python/blob/master/arithmetic_analysis/newton_forward_interpolation.py)
* [Newton Method](https://github.com/TheAlgorithms/Python/blob/master/arithmetic_analysis/newton_method.py)
* [Newton Raphson Method](https://github.com/TheAlgorithms/Python/blob/master/arithmetic_analysis/newton_raphson_method.py)
* [Secant Method](https://github.com/TheAlgorithms/Python/blob/master/arithmetic_analysis/secant_method.py)

## Backtracking
* [All Combinations](https://github.com/TheAlgorithms/Python/blob/master/backtracking/all_combinations.py)
Expand Down Expand Up @@ -36,8 +37,11 @@
* [Brute Force Caesar Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/brute_force_caesar_cipher.py)
* [Caesar Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/caesar_cipher.py)
* [Cryptomath Module](https://github.com/TheAlgorithms/Python/blob/master/ciphers/cryptomath_module.py)
* [Deterministic Miller Rabin](https://github.com/TheAlgorithms/Python/blob/master/ciphers/deterministic_miller_rabin.py)
* [Diffie](https://github.com/TheAlgorithms/Python/blob/master/ciphers/diffie.py)
* [Elgamal Key Generator](https://github.com/TheAlgorithms/Python/blob/master/ciphers/elgamal_key_generator.py)
* [Hill Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/hill_cipher.py)
* [Mixed Keyword Cypher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/mixed_keyword_cypher.py)
* [Morse Code Implementation](https://github.com/TheAlgorithms/Python/blob/master/ciphers/morse_code_implementation.py)
* [Onepad Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/onepad_cipher.py)
* [Playfair Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/playfair_cipher.py)
Expand Down Expand Up @@ -149,6 +153,7 @@
* [Longest Sub Array](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/longest_sub_array.py)
* [Matrix Chain Order](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/matrix_chain_order.py)
* [Max Sub Array](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_sub_array.py)
* [Max Sum Contigous Subsequence](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_sum_contigous_subsequence.py)
* [Minimum Partition](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/minimum_partition.py)
* [Rod Cutting](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/rod_cutting.py)
* [Subset Generation](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/subset_generation.py)
Expand Down Expand Up @@ -228,13 +233,16 @@
* [Abs Min](https://github.com/TheAlgorithms/Python/blob/master/maths/abs_min.py)
* [Average Mean](https://github.com/TheAlgorithms/Python/blob/master/maths/average_mean.py)
* [Average Median](https://github.com/TheAlgorithms/Python/blob/master/maths/average_median.py)
* [Average Mode](https://github.com/TheAlgorithms/Python/blob/master/maths/average_mode.py)
* [Basic Maths](https://github.com/TheAlgorithms/Python/blob/master/maths/basic_maths.py)
* [Binary Exponentiation](https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exponentiation.py)
* [Binomial Coefficient](https://github.com/TheAlgorithms/Python/blob/master/maths/binomial_coefficient.py)
* [Collatz Sequence](https://github.com/TheAlgorithms/Python/blob/master/maths/collatz_sequence.py)
* [Explicit Euler](https://github.com/TheAlgorithms/Python/blob/master/maths/explicit_euler.py)
* [Extended Euclidean Algorithm](https://github.com/TheAlgorithms/Python/blob/master/maths/extended_euclidean_algorithm.py)
* [Factorial Python](https://github.com/TheAlgorithms/Python/blob/master/maths/factorial_python.py)
* [Factorial Recursive](https://github.com/TheAlgorithms/Python/blob/master/maths/factorial_recursive.py)
* [Factors](https://github.com/TheAlgorithms/Python/blob/master/maths/factors.py)
* [Fermat Little Theorem](https://github.com/TheAlgorithms/Python/blob/master/maths/fermat_little_theorem.py)
* [Fibonacci](https://github.com/TheAlgorithms/Python/blob/master/maths/fibonacci.py)
* [Fibonacci Sequence Recursion](https://github.com/TheAlgorithms/Python/blob/master/maths/fibonacci_sequence_recursion.py)
Expand All @@ -257,9 +265,11 @@
* [Mobius Function](https://github.com/TheAlgorithms/Python/blob/master/maths/mobius_function.py)
* [Modular Exponential](https://github.com/TheAlgorithms/Python/blob/master/maths/modular_exponential.py)
* [Newton Raphson](https://github.com/TheAlgorithms/Python/blob/master/maths/newton_raphson.py)
* [Perfect Square](https://github.com/TheAlgorithms/Python/blob/master/maths/perfect_square.py)
* [Polynomial Evaluation](https://github.com/TheAlgorithms/Python/blob/master/maths/polynomial_evaluation.py)
* [Prime Check](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_check.py)
* [Prime Factors](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_factors.py)
* [Prime Numbers](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_numbers.py)
* [Prime Sieve Eratosthenes](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_sieve_eratosthenes.py)
* [Qr Decomposition](https://github.com/TheAlgorithms/Python/blob/master/maths/qr_decomposition.py)
* [Quadratic Equations Complex Numbers](https://github.com/TheAlgorithms/Python/blob/master/maths/quadratic_equations_complex_numbers.py)
Expand Down Expand Up @@ -293,6 +303,8 @@
## Neural Network
* [Back Propagation Neural Network](https://github.com/TheAlgorithms/Python/blob/master/neural_network/back_propagation_neural_network.py)
* [Convolution Neural Network](https://github.com/TheAlgorithms/Python/blob/master/neural_network/convolution_neural_network.py)
* [Gan](https://github.com/TheAlgorithms/Python/blob/master/neural_network/gan.py)
* [Input Data](https://github.com/TheAlgorithms/Python/blob/master/neural_network/input_data.py)
* [Perceptron](https://github.com/TheAlgorithms/Python/blob/master/neural_network/perceptron.py)

## Other
Expand All @@ -309,12 +321,14 @@
* [Game Of Life](https://github.com/TheAlgorithms/Python/blob/master/other/game_of_life.py)
* [Greedy](https://github.com/TheAlgorithms/Python/blob/master/other/greedy.py)
* [Largest Subarray Sum](https://github.com/TheAlgorithms/Python/blob/master/other/largest_subarray_sum.py)
* [Least Recently Used](https://github.com/TheAlgorithms/Python/blob/master/other/least_recently_used.py)
* [Linear Congruential Generator](https://github.com/TheAlgorithms/Python/blob/master/other/linear_congruential_generator.py)
* [Magicdiamondpattern](https://github.com/TheAlgorithms/Python/blob/master/other/magicdiamondpattern.py)
* [Nested Brackets](https://github.com/TheAlgorithms/Python/blob/master/other/nested_brackets.py)
* [Palindrome](https://github.com/TheAlgorithms/Python/blob/master/other/palindrome.py)
* [Password Generator](https://github.com/TheAlgorithms/Python/blob/master/other/password_generator.py)
* [Primelib](https://github.com/TheAlgorithms/Python/blob/master/other/primelib.py)
* [Sdes](https://github.com/TheAlgorithms/Python/blob/master/other/sdes.py)
* [Sierpinski Triangle](https://github.com/TheAlgorithms/Python/blob/master/other/sierpinski_triangle.py)
* [Tower Of Hanoi](https://github.com/TheAlgorithms/Python/blob/master/other/tower_of_hanoi.py)
* [Two Sum](https://github.com/TheAlgorithms/Python/blob/master/other/two_sum.py)
Expand Down Expand Up @@ -390,6 +404,7 @@
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_20/sol1.py)
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_20/sol2.py)
* [Sol3](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_20/sol3.py)
* [Sol4](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_20/sol4.py)
* Problem 21
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_21/sol1.py)
* Problem 22
Expand All @@ -404,6 +419,9 @@
* Problem 25
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol1.py)
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol2.py)
* [Sol3](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol3.py)
* Problem 27
* [Problem 27 Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_27/problem_27_sol1.py)
* Problem 28
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_28/sol1.py)
* Problem 29
Expand All @@ -412,6 +430,8 @@
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_31/sol1.py)
* Problem 32
* [Sol32](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_32/sol32.py)
* Problem 33
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_33/sol1.py)
* Problem 36
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_36/sol1.py)
* Problem 40
Expand Down Expand Up @@ -471,6 +491,7 @@
* [Radix Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/radix_sort.py)
* [Random Normal Distribution Quicksort](https://github.com/TheAlgorithms/Python/blob/master/sorts/random_normal_distribution_quicksort.py)
* [Random Pivot Quick Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/random_pivot_quick_sort.py)
* [Recursive-Quick-Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/recursive-quick-sort.py)
* [Selection Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/selection_sort.py)
* [Shell Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/shell_sort.py)
* [Stooge Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/stooge_sort.py)
Expand All @@ -494,3 +515,4 @@

## Web Programming
* [Crawl Google Results](https://github.com/TheAlgorithms/Python/blob/master/web_programming/crawl_google_results.py)
* [Get Imdbtop](https://github.com/TheAlgorithms/Python/blob/master/web_programming/get_imdbtop.py)
30 changes: 16 additions & 14 deletions ciphers/deterministic_miller_rabin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@ def miller_rabin(n, allow_probable=False):
"A return value of True indicates a probable prime."
)
# array bounds provided by analysis
bounds = [2_047,
1_373_653,
25_326_001,
3_215_031_751,
2_152_302_898_747,
3_474_749_660_383,
341_550_071_728_321,
1,
3_825_123_056_546_413_051,
1,
1,
318_665_857_834_031_151_167_461,
3_317_044_064_679_887_385_961_981]
bounds = [
2_047,
1_373_653,
25_326_001,
3_215_031_751,
2_152_302_898_747,
3_474_749_660_383,
341_550_071_728_321,
1,
3_825_123_056_546_413_051,
1,
1,
318_665_857_834_031_151_167_461,
3_317_044_064_679_887_385_961_981,
]

primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]
for idx, _p in enumerate(bounds, 1):
Expand Down Expand Up @@ -131,5 +133,5 @@ def test_miller_rabin():
# upper limit for probabilistic test


if __name__ == '__main__':
if __name__ == "__main__":
test_miller_rabin()
15 changes: 7 additions & 8 deletions ciphers/diffie.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
def find_primitive(n):
for r in range(1, n):
li = []
for x in range(n-1):
val = pow(r,x,n)
for x in range(n - 1):
val = pow(r, x, n)
if val in li:
break
li.append(val)
Expand All @@ -11,16 +11,15 @@ def find_primitive(n):


if __name__ == "__main__":
q = int(input('Enter a prime number q: '))
q = int(input("Enter a prime number q: "))
a = find_primitive(q)
a_private = int(input('Enter private key of A: '))
a_private = int(input("Enter private key of A: "))
a_public = pow(a, a_private, q)
b_private = int(input('Enter private key of B: '))
b_private = int(input("Enter private key of B: "))
b_public = pow(a, b_private, q)

a_secret = pow(b_public, a_private, q)
b_secret = pow(a_public, b_private, q)

print('The key value generated by A is: ', a_secret)
print('The key value generated by B is: ', b_secret)

print("The key value generated by A is: ", a_secret)
print("The key value generated by B is: ", b_secret)
4 changes: 2 additions & 2 deletions data_structures/binary_tree/basic_binary_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def display(tree): # In Order traversal of the tree


def depth_of_tree(
tree
tree,
): # This is the recursive function to find the depth of binary tree.
if tree is None:
return 0
Expand All @@ -36,7 +36,7 @@ def depth_of_tree(


def is_full_binary_tree(
tree
tree,
): # This functions returns that is it full binary tree or not?
if tree is None:
return True
Expand Down
1 change: 0 additions & 1 deletion data_structures/binary_tree/treap.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def main():
args = input()

print("good by!")



if __name__ == "__main__":
Expand Down
7 changes: 4 additions & 3 deletions data_structures/heap/min_heap.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ def sift_down(self, idx, array):

if smallest != idx:
array[idx], array[smallest] = array[smallest], array[idx]
self.idx_of_element[array[idx]], self.idx_of_element[
array[smallest]
] = (
(
self.idx_of_element[array[idx]],
self.idx_of_element[array[smallest]],
) = (
self.idx_of_element[array[smallest]],
self.idx_of_element[array[idx]],
)
Expand Down
4 changes: 1 addition & 3 deletions data_structures/linked_list/doubly_linked_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def insertHead(self, x):
def deleteHead(self):
temp = self.head
self.head = self.head.next # oldHead <--> 2ndElement(head)
self.head.previous = (
None
) # oldHead --> 2ndElement(head) nothing pointing at it so the old head will be removed
self.head.previous = None # oldHead --> 2ndElement(head) nothing pointing at it so the old head will be removed
if self.head is None:
self.tail = None # if empty linked list
return temp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#############################
from typing import List


def CeilIndex(v, l, r, key):
while r - l > 1:
m = (l + r) // 2
Expand Down Expand Up @@ -49,4 +50,5 @@ def LongestIncreasingSubsequenceLength(v: List[int]) -> int:

if __name__ == "__main__":
import doctest

doctest.testmod()
1 change: 1 addition & 0 deletions dynamic_programming/max_sub_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def max_sub_array(nums: List[int]) -> int:
import time
import matplotlib.pyplot as plt
from random import randint

inputs = [10, 100, 1000, 10000, 50000, 100000, 200000, 300000, 400000, 500000]
tim = []
for i in inputs:
Expand Down
4 changes: 2 additions & 2 deletions file_transfer/send_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import socket # Import socket module

ONE_CONNECTION_ONLY = (
True
) # Set this to False if you wish to continuously accept connections
True # Set this to False if you wish to continuously accept connections
)

filename = "mytext.txt"
port = 12312 # Reserve a port for your service.
Expand Down
2 changes: 1 addition & 1 deletion maths/factorial_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def factorial(input_number: int) -> int:
return result


if __name__ == '__main__':
if __name__ == "__main__":
import doctest

doctest.testmod()
2 changes: 1 addition & 1 deletion maths/factorial_recursive.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def factorial(n: int) -> int:
return 1 if n == 0 or n == 1 else n * factorial(n - 1)


if __name__ == '__main__':
if __name__ == "__main__":
import doctest

doctest.testmod()
2 changes: 1 addition & 1 deletion maths/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int:
>>> gaussian(2523, mu=234234, sigma=3425)
0.0
"""
return 1 / sqrt(2 * pi * sigma ** 2) * exp(-(x - mu) ** 2 / 2 * sigma ** 2)
return 1 / sqrt(2 * pi * sigma ** 2) * exp(-((x - mu) ** 2) / 2 * sigma ** 2)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion maths/perfect_square.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def perfect_square(num: int) -> bool:
return math.sqrt(num) * math.sqrt(num) == num


if __name__ == '__main__':
if __name__ == "__main__":
import doctest

doctest.testmod()
Loading