Commit Graph

2663 Commits

Author SHA1 Message Date
Dylan Buchi
ac4bdfd66d
[mypy] Fix type annotations in graphs/boruvka.py (#5794)
* Fix type annotations in boruvka.py

* Remove graphs/boruvka.py|

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-08 21:47:09 +08:00
Khoi Vo
2f6a7ae1fa
ADD the algorithms of image augmentation (#5792)
* ADD the algorithms of image augmentation

* ADD the algorithms of image augmentation

* ADD the algorithms of image augmentation

* ADD the algorithms of image augmentation

* ADD the algorithms of image augmentation

* ADD the algorithms of image augmentation

* UPDATE format code

* UPDATE format and recode structure

* UPDATE format import library

* UPDATE code structure

* Fix all checks have failded

* FIX variable format

* FIX variable format

* FIX variable format

* FIX code structure

* FIX code structure

* FIX code structure

* FIX code structure
2021-11-08 06:35:40 +01:00
Rohan R Bharadwaj
a98465230f
[mypy] Fix type annotations for maths directory (#5782)
* [mypy] Fix annotations in `maths/series/p_series.py`

* Update p_series.py

* Update p_series.py

* Remove from excluded in mypy.ini

* Type annotation for series

* Annotate maths/proth_number.py (properly)

* Remove from excluded in mypy.ini

* Annotate average_mode.py

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Remove from excluded in mypy.ini

* Fix annotations in gamma_recursive.py

* Remove from excluded in mypy.ini

* Annotations for geometric_series.py

* Update geometric_series.py

* Update mypy.ini

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Update mypy.ini

* Update mypy.ini

* Update mypy.ini

* Update average_mode.py

* Update proth_number.py

* Update average_mode.py

* Update gamma_recursive.py

* Update proth_number.py

* Update mypy.ini

* Update geometric_series.py

* Update average_mode.py

* Update proth_number.py

* Update geometric_series.py

* Update geometric_series.py

* Update geometric_series.py

* Update p_series.py

* Update geometric_series.py

* Update p_series.py

* Update p_series.py

* Update geometric_series.py

* Update p_series.py

* Update p_series.py

* Remove data_structures/stacks/next_greater_element.py|

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-07 16:13:58 +01:00
Rohan R Bharadwaj
db5aa1d188
Add equated_monthly_installments.py in Financials (#5775)
* Add equated_monthly_installments.py in Financials

* Formatting

* More formatting, Descriptive names

* Errors with name change

* Formatting

* Formatting, Naming Error

* dedent

* Update DIRECTORY.md
2021-11-07 15:40:23 +01:00
Rohan R Bharadwaj
accee50cde
[mypy] Fix other/fischer_yates_shuffle.py (#5789)
* [mypy] Fix `other/fischer_yates_shuffle.py`

* Update mypy.ini
2021-11-07 11:14:42 +01:00
Christian Clauss
8ac86f2ce5
mypy: Exclude only 20 files that are still failing (#5608)
* DRAFT: Run a mypy reality check

Let's see what is required to finish  #4052

* mypy --ignore-missing-imports --install-types --non-interactive

* Check our progress...

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* mypy --exclude 20 files

* --exclude with no `=`

* Update build.yml

* 558 character regex!!!

* With quotes

* mypy.ini: mega exclude

* Update mypy.ini

* Update build.yml

* Update mypy.ini

* Update build.yml

* Update mypy.ini

* .py --> .p*

* Escape the dots!: `.` --> `\.`

* Remove the comment

* Leading slash

* Update mypy.ini

Co-authored-by: Dylan Buchi <devybuchi@gmail.com>

Co-authored-by: Dylan Buchi <devybuchi@gmail.com>
2021-11-06 13:58:15 +01:00
Dylan Buchi
e7381b513b
[mypy] Fix type annotations in data_structures/stacks/next_greater_element.py (#5763)
* Fix type annotations in next_greater_element.py

* Refactor next_greater_element.py
2021-11-05 20:45:37 +01:00
Maxim Smolskiy
1a43c92c77
Improve Project Euler problem 043 solution 1 (#5772)
* updating DIRECTORY.md

* Fix typo

* Improve solution

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-05 20:44:24 +01:00
Rohan R Bharadwaj
48960268a2
Improve Project Euler Problem 10 Sol-1 (#5773)
* Improve Project Euler Problem 10 Sol-1

* Name correction

* psf/black formatting

* More formatting
2021-11-05 20:43:52 +01:00
Leoriem-code
6b2b476f86
fix typo on line 126 (#5768) 2021-11-05 06:06:37 +01:00
Boris Galochkin
dbddac74d3
Fix graphs/finding_bridges.py algorithm + doctests (#5765)
* Fix finding_bridges algorithms + tests

* update type hints

* Better, more obvious condition fix

* fix prev commit + more tests

* Short explanation + url

* Update finding_bridges.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-04 17:51:31 +01:00
Snimerjot Singh
7390777f9a
Added 2 shaped in volume.py (#5560) 2021-11-04 17:08:18 +01:00
Maxim Smolskiy
729aaf6427
Improve Project Euler problem 014 solution 2 (#5744)
* Improve solution

* Uncomment code that has been commented due to slow execution affecting Travis

* Fix

* scikit-fuzzy is causing broken builds

* fuzz = None

* Update fuzzy_operations.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-04 17:01:21 +01:00
Dylan Buchi
7a605766fe
[mypy] Fix type annotations in data_structures/binary_tree/red_black_tree.py (#5739)
* [mypy] Fix type annotations in red_black_tree.py

* Remove blank lines

* Update red_black_tree.py
2021-11-04 16:38:43 +01:00
Maxim Smolskiy
e835e96856
Improve Project Euler problem 014 solution 1 (#5747)
* Improve solution

* Uncomment code that has been commented due to slow execution affecting Travis

* Fix
2021-11-04 16:37:47 +01:00
Jaydeep Das
b6eb448e63
Added reddit.py to get data from reddit (#5698)
* Rewritten reddit.py

* Removed logging module import

* Fixed minor bug which was causing extreme rate limiting

* Update reddit.py

* Update reddit.py

* Update reddit.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-04 16:36:22 +01:00
Sailesh Shrestha
3815a97575
Add all_construct dynamic programming implementation (#5626)
* Add all_construct dynamic programming implementation

* all_construct: remove the main function

* all_construct: Add type hints

* all_construct: changed map to list comprehension,fix mutable default arguments

* all_construct: fixed type hints

* all_construct: cleaner code for initializing word_bank argument

* all_construct: added an import for annotations

* all_construct: added None in the argument with word_bank

* all_construct: fixed a type hint

* all_construct: Fixed some more type hints
2021-11-04 16:18:38 +01:00
Leoriem-code
47dd31f4a1
Add README files 1/7 (#5754)
* Added 5 README files

* corrected arithmetic_analysis README

* Update audio_filters/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update backtracking/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update bit_manipulation/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-04 18:49:36 +08:00
Divyesh Vishwakarma
9655ec2a05
Added newtons_second_law_of_motion.py (#5474) 2021-11-04 18:48:57 +08:00
Dylan Buchi
331fe6d3bc
[mypy] Fix type annotations in data_structures/binary_tree/lowest_common_ancestor.py (#5757)
* Fix type annotations in lowest_common_ancestor.py

* Refactor line 53 in lowest_common_ancestor.py
2021-11-03 21:34:08 +01:00
Andrew Grangaard
7954a3ae16
[mypy] Fixes typing errors in other/dpll (#5759)
+ As per usage examples, clause literals are a list of strings.
  + Note: symbols extracted from literals are expected to be exactly two characters.
+ self.literal boolean values are initialized to None, so must be optional
+ model values should be Booleans, but aren't guaranteed to be non-None
  in the code.
+ uses newer '... | None' annotation for Optional values
+ clauses are passed to the Formula initializer as both lists and sets, they
  are stored as lists.  Returned clauses will always be lists.
+ use explicit tuple annotation from __future__  rather than using (..., ...)
  in return signatures
+ mapping returned by dpll_algorithm is optional per the documentation.
2021-11-03 21:32:49 +01:00
Maxim Smolskiy
765be4581e
Improve Project Euler problem 012 solution 2 (#5760)
* Improve solution

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-03 21:32:10 +01:00
Souvik Ghosh
0ea5c734e1
sock_merchant.py: Matching socks by color (#5761)
* Python file for finding number of pairs

* updating DIRECTORY.md

* fixed iterative_pair.py

* further fixed with type casting

* fixed naming conventions

* further fixed with naming convention

* documented done

* build issue fixed

* updating DIRECTORY.md

* Revert "documented done"

This reverts commit 3be15ca374.

* Update canny.py

* Update test_digital_image_processing.py

* Update sobel_filter.py

* requirements.txt fixed

* keras<2.7.0

* Update sock_merchant.py

* doctest with black fixed

* Update sock_merchant.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-03 21:24:50 +01:00
Vɪɴᴀʏᴀᴋ Pᴀɴᴅᴇʏ
85ee27687a
Add Hexagonal Numbers in directory (#5696)
Yesterday hexagonal_numbers.py was created. Added that file in this list(maths/series/hexagonal_numbers.py)
2021-11-03 18:32:17 +08:00
Maxim Smolskiy
37bc6bdebf
Replace Travis CI mentions with GitHub actions (#5751) 2021-11-02 22:28:09 +01:00
Leoriem-code
60ad32920d
fixed typo for codespell (#5753) 2021-11-02 22:17:57 +01:00
Maxim Smolskiy
dd19d8120d
Uncomment code that has been commented due to slow execution affecting Travis (#5745) 2021-11-02 14:07:07 +01:00
krishchopra02
0124b73484
Add a gray_code_sequence.py file to the bit_manipulation folder (#5038)
* Added a gray_code_sequence.py file to the bit_manipulation folder

* Added a descriptive name for variable n changing it to bit count

* Update gray_code_sequence.py

Co-authored-by: krishchopra02 <krishchopra02@gmail.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-02 18:13:49 +08:00
Rohan R Bharadwaj
bdd135d403
Split base85.py into functions, Add doctests (#5746)
* Update base16.py

* Rename base64_encoding.py to base64.py

* Split into functions, Add doctests

* Update base16.py
2021-11-02 11:10:25 +01:00
Dylan Buchi
24731b078c
[mypy] fix type annotations in data_structures/queue/circular_queue_linked_list.py (#5749)
* [mypy] fix type annotations in circular_queue_linked_list

* Remove 10 blank lines

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-02 11:09:46 +01:00
Matthew Wisdom
3c8fec1316
Add Neville's algorithm for polynomial interpolation (#5447)
* Added nevilles algorithm for polynomial interpolation

* Added type hinting for neville_interpolate function arguments.

* Added more descriptive names

* Update nevilles_method.py

* Fixed some linting issues

* Fixed type hinting error

* Fixed nevilles_method.py

* Add ellipsis for doctest spanning multiple lines

* Update nevilles_method.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-02 18:07:36 +08:00
Mozartus
424c200847
Add gabor filter (#5289)
* add gabor_filter.py

* Update gabor_filter.py

* update gabor_filter.py

* add doctest

* change import order

* Update digital_image_processing/filters/gabor_filter.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update gabor_filter.py

* fix gabor filter calculation

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-02 18:06:39 +08:00
Rohan R Bharadwaj
5910c3aa78
Typo (#5750) 2021-11-02 10:20:55 +01:00
Brian Evans
dc6e77338c
Add stone unit of measuring weight (#5730)
* Add stone unit of measuring weight

And some tests in the docs using an external calculator. Not yet tested if they pass.

* Fix rounding descrepencies in doctests to pass tests
2021-11-02 00:09:40 +01:00
Christian Clauss
74f4967126
Fix comment (#5742)
* Fix comment

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-01 18:07:47 +01:00
Tianyi Zheng
84cca2119c
Rewrite maths/fibonacci.py (#5734)
* Rewrite parts of Vector and Matrix methods

* Refactor determinant method and add unit tests

Refactor determinant method to create separate minor and cofactor
methods.
Add respective unit tests for new methods.
Rename methods using snake case to follow Python naming conventions.

* Reorganize Vector and Matrix methods

* Update linear_algebra/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Fix punctuation and wording

* Apply suggestions from code review

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Deduplicate euclidean length method for Vector

* Add more unit tests for Euclidean length method

* Fix bug in unit test for euclidean_length

* Remove old comments for magnitude method

* Rewrite maths/fibonacci.py

* Rewrite timer and add unit tests

* Fix typos in fib_binet unit tests

* Fix typos in fib_binet unit tests

* Clean main method

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-01 18:06:35 +01:00
Kelly Costa
68ca61ecb7
Add search book via ISBN using openlibrary.org API (#5736)
* Add search book via ISBN using openlibrary.org API

* FIX: parameters type hints and isbn sizes

* Add doctests

* Update search_books_by_isbn.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-01 14:36:18 +01:00
Maxim Smolskiy
71ba3a1ad9
Improve Project Euler problem 012 solution 1 (#5731)
* Improve solution

* Uncomment code that has been commented due to slow execution affecting Travis

* Retest
2021-11-01 07:27:19 +01:00
Tianyi Zheng
06ab650e08
Merge maths/fibonacci.py and maths/fibonacci_sequence_recursion.py (#5738)
* Rewrite parts of Vector and Matrix methods

* Refactor determinant method and add unit tests

Refactor determinant method to create separate minor and cofactor
methods.
Add respective unit tests for new methods.
Rename methods using snake case to follow Python naming conventions.

* Reorganize Vector and Matrix methods

* Update linear_algebra/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Fix punctuation and wording

* Apply suggestions from code review

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Deduplicate euclidean length method for Vector

* Add more unit tests for Euclidean length method

* Fix bug in unit test for euclidean_length

* Remove old comments for magnitude method

* Rewrite maths/fibonacci.py

* Rewrite timer and add unit tests

* Fix typos in fib_binet unit tests

* Fix typos in fib_binet unit tests

* Clean main method

* Merge fibonacci.py and fibonacci_sequence_recursion.py

* Fix fib_binet unit test

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-01 07:25:40 +01:00
Rohan R Bharadwaj
99cf2cc1c5
Fix build issues due to count (#5725)
* Fix build issues due to count

* Update check_anagrams.py
2021-10-31 22:56:33 +01:00
Edward Nuno
94f38dd88c
[mypy] Fix type annotations for linked_stack.py (#5576)
* Fix type annotations for linked_stack.py

* Replace Optional with inline union type

* Rename linked_stack to stack_with_singly_linked_list

* Rename stack_using_dll to stack_with_doubly_linked_list

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-31 17:03:03 +01:00
Maarten
868c2fa0a8
Rewrite fibonacci.py (#5665) (#5677)
* Removed doctest call

* Removed 0 and 1 append to `fib_array`

* Moved fibonacci sequence logic into `calculate`

* Refactored `get` to generate missing numbers

* Renamed `fib_array` to `sequence`

* Renamed `number` to `index`

* Refactored `get` to only return sequence to `index`

* Moved main block into function

* Added documentation to `get`

* Added missing type hints

* Fixed doctest error in `get` docstring

* Moved calculate logic into get

* Reformatted with black

* Fixed wrong generation range
2021-10-31 22:19:44 +08:00
Tianyi Zheng
a64c9f1e7c
Deduplicate euclidean_length method in Vector (#5658)
* Rewrite parts of Vector and Matrix methods

* Refactor determinant method and add unit tests

Refactor determinant method to create separate minor and cofactor
methods.
Add respective unit tests for new methods.
Rename methods using snake case to follow Python naming conventions.

* Reorganize Vector and Matrix methods

* Update linear_algebra/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Fix punctuation and wording

* Apply suggestions from code review

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Deduplicate euclidean length method for Vector

* Add more unit tests for Euclidean length method

* Fix bug in unit test for euclidean_length

* Remove old comments for magnitude method

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-10-31 22:16:02 +08:00
Venkatesh Tantravahi
508589e3fc
Local Weighted Learning (#5615)
* Local Weighted Learning Added

* Delete LWL directory

* Local Weighted Learning Added

* local weighted learning added

* Delete LWL directory

* Delete local_weighted_learning.py

* rephrased code added

* local weight learning updated

* local weight learning updated

* Updated dir

* updated codespell

* import modification

* Doctests added

* doctests updated

* lcl updated

* doctests updated

* doctest values updated
2021-10-31 12:27:50 +01:00
Dylan Buchi
7488c5070e
Fix type annotations in randomized_heap.py (#5704) 2021-10-31 11:49:34 +01:00
Simon
0f015fa034
Added solution for euler problem 493 (#5573)
* Added solution for problem 493

* fixed typo

* return result as string
2021-10-31 11:48:10 +01:00
happiestbee
f4fd147d03
Make decrypt_caesar_with_chi_squared work with upper case letters (#5379)
* Fixes: #5323

* Fixes: #5323
2021-10-31 11:46:31 +01:00
Morteza
9ac94c09eb
Improve checking anagrams in O(n) with dictionary (#4806) 2021-10-31 11:41:39 +01:00
SURYAPRATAP SINGH SURYAVANSHI
13fdf21c9c
Added alternative_list_arrange method (#4631) 2021-10-31 11:40:32 +01:00
Maxim Smolskiy
f92eac982d
Improve Project Euler problem 092 solution 1 (#5703)
* Fix typos

* Improve solution
2021-10-31 11:38:28 +01:00