Commit Graph

1785 Commits

Author SHA1 Message Date
Furkan Atesli
6f80ca821c
Create change_brightness.py (#2126)
* Create change_brightness.py

* Update change_brightness.py

* Update change_brightness.py

* Update change_brightness.py

* Update change_brightness.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-17 07:49:20 +02:00
Christian Clauss
f97af65579
Blacken our code (#2125)
* Blacken

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-17 06:59:38 +08:00
bnMikheili
62f7561428
Hash djb2 (#2098)
* implement hash

* fix flake8 error

* Update hashes/djb2.py

* Update hashes/djb2.py

* Long lines

* def djb2(s: str) -> int:

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-16 22:22:47 +02:00
beqakd
924ef9b7d8
implementation of entropy algorithm. (#2110)
* implementation of entropy algorithm.

* add tests, fix requested changes

* open_file() --> analyze_text()

* Create bidirectional_breadth_first_search.py

* # type: ignore

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-16 21:36:57 +02:00
Erwin Lejeune
a5c246793c
Graphs : Bidirectional Breadth-First Search (#2057)
* implement bidirectional breadth first

* remove useless import

* remove trailing whitespaces
2020-06-16 17:10:22 +02:00
Christian Clauss
4e8a0d924e
CONTRIBUTING.md: Update flake8 command (#2124)
* CONTRIBUTING.md: Update flake8 command

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 16:33:17 +02:00
Muhammadrasul
4a2d457747
Count (#2084)
* Add files via upload

* Update and rename count_islands.py to count_islands_in_matrix.py

* Update matrix/count_islands_in_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/count_islands_in_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/count_islands_in_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Reformat count islands.py

* Indent Python code with 4 spaces, not tabs

* Update count_islands_in_matrix.py

* Add type hints for return values

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-16 14:36:09 +02:00
Christian Clauss
b9e5259aeb
Fix long line, tests (#2123)
* Fix long line

* updating DIRECTORY.md

* Add doctest

* ...

* ...

* Update tabu_search.py

* space

* Fix doctest

    >>> find_neighborhood(['a','c','b','d','e','a'])  # doctest: +NORMALIZE_WHITESPACE
    [['a','e','b','d','c','a',90], [['a','c','d','b','e','a',90],
     ['a','d','b','c','e','a',93], ['a','c','b','e','d','a',102],
     ['a','c','e','d','b','a',113], ['a','b','c','d','e','a',93]]

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-06-16 14:29:13 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Michael Quevillon
9438c6bf0b
Add pytest init file to define custom mark mat_ops (#2120)
Fixes #1917.
2020-06-15 18:09:32 +02:00
Christian Clauss
0b028aa32a
Fix line break after binary operator (#2119)
* Fix line break after binary operator

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-15 15:47:02 +02:00
beqakd
23dae9ceab
implement rat in maze algorithm. (#2106)
* implement rat in maze algorithm.

* style changes

* fix trailing whitespace

* add test, fix style

* fix style

* method change

* minor changes

* style changes

* return solved

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-15 15:03:30 +02:00
Christian Clauss
b9185bebd6
Create natural_language_processing (#2116)
* Create natural_language_processing

Closes #2115

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-15 09:55:41 +02:00
bnMikheili
55b3088e47
Hash adler32 (#2111)
* implement hash

* fix indentation
2020-06-14 09:49:39 +02:00
Christian Clauss
ae9d0f9196
Fix indentation (#2097) 2020-06-14 14:28:00 +08:00
Nika Losaberidze
8bb7b8f457
Fix syntax for flake8 passing (#2096)
* Fix syntax for flake8 passing

* fixup! Format Python code with psf/black push

* # fmt: off / # fmt: on

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-12 06:51:47 +02:00
bnMikheili
ec2d900b03
implement sdbm hash algorithm (#2094)
* implement sdbm hash algorithm

* fix bug: styling

* fix styling for decimal_to_any
2020-06-11 22:22:16 +02:00
Nika Losaberidze
2264244a34
Add Z-function algorithm implementation (#2067)
* Add Z-function algorithm implementation

* Spelling correction

* Reference url correction

* Add additional function as an example of z-function usage, change docstrings for functions

* Fix flake8 errors

* Update z_function.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-11 19:43:05 +02:00
Vignesh
3893ed30ca
created perfect_cube.py (#2076)
* created perfect_cube.py

To find whether a number is a perfect cube or not.

* Update perfect_cube.py

* Update perfect_cube.py

* Update perfect_cube.py
2020-06-11 19:36:53 +02:00
Kevin C. Escobedo
19c3871b21
Added function to convert from decimal to another base (#2087)
* Added function to convert from decimal to another base

* Update conversions/decimal_to_any.py

Changed type() to isinstance()

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Changed to base in (0, 1)

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Updated to div not in (0, 1)

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Updated to make condition clearer

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Using divmod() instead of % operator

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Improved readability on a docstring test

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Changed use of type() to isinstance()

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Changed from use of type() to isinstance()

Co-authored-by: Christian Clauss <cclauss@me.com>

* Made changes and improved function

* Update conversions/decimal_to_any.py

Added space to docstring test

Co-authored-by: Christian Clauss <cclauss@me.com>

* Changed action for bad input

* Added support for conversions up to base 36 (#2087)

* Added support for conversions up to base 36 and renamed HEXADECIMAL dict (#2087)

* Fixed whitespace issue (#2087)

* Fixed issue with line length (#2087)

* Fixed issue with conversions past base-10 failing (#2087)

* Added more robust testing (#2087)

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-11 17:59:42 +02:00
ocivo
a7b4311378
fix fetch_github_info __main__ bug (#2080)
* fix fetch_github_info __main__ bug

* Algorithms should not print

* Update fetch_github_info.py

* Update fetch_github_info.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-06-11 16:38:43 +02:00
Christian Clauss
657d46101d
calc_profit always returns an int (#2090)
* calc_profit always returns an int

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-11 16:36:09 +02:00
mateuszz0000
3de6f010c3
Refactor remove duplicates to more pythonic (#2093)
* Refactor strings/remove_duplicate to more pythonic

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-11 06:13:40 +02:00
Jeffin Francis
bf0da25e4f
Added Readme for computer vision (#2075)
* Create README.md

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-10 17:10:47 +02:00
mateuszz0000
e553f4bf11
Added travis notifications only on fail (#2091)
* Added travis notifications only on fail

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-10 12:40:52 +02:00
Apoorve
7be3d0f667
Create-Add files to greedy_method directory (#2082)
* Add Greedy Method Approach

* Update Filename

* Update Variable and Links

* Fixed flake8 bugs

* Update unittest filename

* Update unittest filename

* Final unittest filename update

* Pythonic Code formatting

* flake8 fixes

* lowercase function name

* Add zip function

* Add zip function

* params lowercase

* Travis CI fixes

* Update and rename knapsack_problem.py to knapsack.py

* Update test_knapsack.py

* Fix bugs

* Rename knapsack.py to greedy_knapsack.py

* Update test_knapsack.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-09 17:59:19 +02:00
mateuszz0000
1e7df7f77a
Errors notifications under pull requests (#2081)
* Added error comments under pull requests

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-08 14:11:01 +02:00
mateuszz0000
6752e9c737
Remove boilerplate comments and unused variables (#2073) 2020-06-07 23:05:22 +02:00
mateuszz0000
20b21e5ec9
Refactor cycle_sort (#2072)
* Refactor cycle_sort

* Undo changes to keep only doctests
2020-06-05 09:13:43 +02:00
Jeffin Francis
7a14285cb6
Harris corner detection (#2064)
* Added Lstm example for stock predection

* Changes after review

* changes after build failed

* Add Kiera’s to requirements.txt

* requirements.txt: Add keras and tensorflow

* psf/black

* haris corner detection

* fixup! Format Python code with psf/black push

* changes after review

* changes after review

* fixup! Format Python code with psf/black push

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-04 16:02:51 +02:00
Vignesh
0904610a76
create sum_of_digits.py (#2065)
* create sum_of_digits.py

create sum_of_digits.py to find the sum of digits of a number
digit_sum(12345) ---> 15
digit_sum(12345) ---> 10

* Update sum_of_digits.py

* Update maths/sum_of_digits.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update maths/sum_of_digits.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update sum_of_digits.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-02 23:38:32 +02:00
Martin Röbke
35319a2a2a
Update build_directory_md.py (#2066)
Propagate argument `top_dir` to good_file_paths.
Previously this argument did not get passed to the helper function when calling print_directory_md.
2020-06-02 21:14:12 +02:00
Shivam Verma
d7cc778092
conversions/decimal_to_binary.py: Add type hints (#2001)
* A .py file to covert a base to any new base(2-18)

* Update base_changer.py

* Added type-hints.

* Delete base_changer.py
2020-06-02 16:47:10 +02:00
mateuszz0000
b080a5e027
Doctests + typehints in cocktail shaker sort (#2061)
* Doctests in cocktail shaker sort

* import doctest

* print(f"{cocktail_shaker_sort(unsorted) = }")

Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-02 11:51:22 +02:00
Vignesh
dc720a83d7
Create number_of_digits.py (#1975)
* Create number_of_digits.py

A python program to find the number of digits in a number.

* Update number_of_digits.py

* Update number_of_digits.py

* Add #1976 to get Travis CI to pass

#1976

* Add type hints as discussed in CONTRIBUTING.md

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-01 17:23:15 +02:00
mateuszz0000
1a254465e3
Naive string doctests + typehints (#2054)
* Added doctests

* Added __main__

* Commit suggestion

* Undo changes to keep only doctests and typehints

* Reundo function name with params

* Update naive_string_search.py

* Update naive_string_search.py

* Update naive_string_search.py

* Update naive_string_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-01 15:40:40 +02:00
Lakshmikanth2001
321b1425e3
data_structures/linked_list: Add __len__() function and tests (#2047)
* Update __init__.py

please add a function to get length of linked list

* Update __init__.py

* Update doubly_linked_list.py

all size function lo doubly linked list class

* prime number _better method

* comments

* Updated init.py 2

made it more pythonic

* updated length function

* commnet in linked_list construtor

* Update data_structures/linked_list/__init__.py

accepecting changes

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update data_structures/linked_list/__init__.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update __init__.py

* Revert changes to doubly_linked_list.py

* Revert changes to prime_check.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-31 11:37:45 +02:00
Christian Clauss
1e8fe8efcf
circular_linked_list: Add more len() tests (#2051)
* circular_linked_list: Add more len() tests

* fixup! Format Python code with psf/black push

* prepend()

* updating DIRECTORY.md

* Fix decrementation of self.length

* Add empty list tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-31 13:06:57 +05:30
mateuszz0000
3357768fc3
Jaro winkler (#2041)
* Added jaro_winkler first version

* Added doctests

* Fix flake warnings

* Refactor

* Fixes bug in jaro winkler implementation

* Commit suggestions

* Missing comming suggestions

* Remove unused math module

* Import doctest

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-05-31 00:14:55 +05:30
Christian Clauss
fa358d614a
current_weather, weather_forecast, weather_onecall (#2048)
* current_weather, weather_forecast, weather_onecall

* updating DIRECTORY.md

* weather_forecast("Kolkata, India")

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-30 23:47:26 +05:30
Swapnanil Dutta
f8bfd0244d
Created weatherforecast.py (#2037)
* Created weatherforecast.py

Added weatherforecast.py to retrieve weather information of a location and return dictionary values.

* Update weatherforecast.py

* Update and rename weatherforecast.py to current_weather.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-30 17:25:06 +02:00
KDH
4768735668
Enhance shell sort syntax (#2035) 2020-05-26 04:18:03 +02:00
Nitisha Bharathi
0e619065e7
added Boruvka's MST algorithm (#2026)
* added Boruvka's MST algorithm

* Add files via upload

* fixup! Format Python code with psf/black push

* Updated Boruvka with doctest

* updating DIRECTORY.md

* Update minimum_spanning_tree_boruvka.py

* No blank line in doctest

* <BLANKLINE>

* Avoid mutable default values

https://docs.python-guide.org/writing/gotchas/

* Update minimum_spanning_tree_boruvka.py

* Avoid mutable default values

* fixup! Format Python code with psf/black push

* Update minimum_spanning_tree_boruvka.py

* Update minimum_spanning_tree_boruvka.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-25 15:10:54 +02:00
mateuszz0000
bb5552efd0
Euclidean recursive method + doctests + type hints (#1999)
* Recursive euclidean algorithm + doctests and type hints

* Fix doctests in recursive method

* Added commit suggestions
2020-05-25 12:32:57 +02:00
Christian Clauss
dc4049ee28
.travis.yml: Revert to using autoblack (#2033)
* .travis.yml: Revert to using autoblack

Our autoblack GitHub Action will get us to black compliance without forcing each contributor to learn about, install, and use psf/black on every pull request.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-24 20:38:28 +05:30
Ekansh Mangal
025b1a6989
Merge sort Update variable names (#2032)
* Update Merge sort variable names

* Update mergesort.py

* Update mergesort.py

* black

* Update mergesort.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-24 08:38:43 +02:00
Ashwin Das
d8a4faf96d
Update is_palindrome.py (#2025)
* Update is_palindrome.py

* Update is_palindrome.py

* Reuse s

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-22 11:57:23 +02:00
mateuszz0000
a15f82579d
Added bead sort (#2022)
* Added bead sort

* Commit suggestion

* Added checking before sort

* Bead sort only works for sequences of nonegative integers

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-22 09:41:40 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Erwin Lejeune
21ed8968c0
Fixes in Bidirectional A* (#2020)
* implement bidirectional astar

* add type hints

* add wikipedia url

* format with black

* changes from review

* fix collision check

* Add testmod()

* # doctest: +NORMALIZE_WHITESPACE

* Codespell: euclidean

* Codespell: coordinates

* Codespell: traversal

* Codespell: remaining

Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-21 21:50:52 +02:00