Skip to content
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

added type hints for backtracking/minimax.py #2313

Closed
wants to merge 57 commits into from
Closed

added type hints for backtracking/minimax.py #2313

wants to merge 57 commits into from

Conversation

Abdujabbar
Copy link
Contributor

@Abdujabbar Abdujabbar commented Aug 15, 2020

Added type hints and little modification for readability on backtracking/minimax.py

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@Abdujabbar
Copy link
Contributor Author

@cclauss do we need add some test cases?

@cclauss
Copy link
Member

cclauss commented Aug 21, 2020

Yes, please. And please don't forget the difficult case like depth is -1 or scores is [], etc.

@TravisBuddy
Copy link

Hey @abdujabbor,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 109d16a0-e7c7-11ea-b1e9-0f855a8df5b8

@TravisBuddy
Copy link

Travis tests have failed

Hey @abdujabbor,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 91feece0-e7c8-11ea-b1e9-0f855a8df5b8

@Abdujabbar
Copy link
Contributor Author

@cclauss look I think it's better than the previous version

@Abdujabbar Abdujabbar marked this pull request as ready for review August 30, 2020 20:02
Littlecowherd and others added 19 commits August 31, 2020 18:55
* Update CONTRIBUTING.md

fixed dead link to the license

* Update README.md

Added License

* Update README.md

* Update README.md

* Update README.md

* Update CONTRIBUTING.md

Co-authored-by: Christian Clauss <[email protected]>
* added idf-smooth

* added idf-smooth

* added idf-smooth
* Create capitalize.py

This function will capitalize the first character of a sentence or a word

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update strings/capitalize.py

Co-authored-by: Christian Clauss <[email protected]>

* Update capitalize.py

* Update strings/capitalize.py

Co-authored-by: Christian Clauss <[email protected]>

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update strings/capitalize.py

Co-authored-by: Christian Clauss <[email protected]>

* Update capitalize.py

* Update strings/capitalize.py

Co-authored-by: Christian Clauss <[email protected]>

* Update capitalize.py

* Update capitalize.py

Co-authored-by: Christian Clauss <[email protected]>
* Create hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <[email protected]>

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <[email protected]>

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Christian Clauss <[email protected]>

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Christian Clauss <[email protected]>

* Update hexadecimal_to_decimal

Added negative hexadecimal conversion to decimal number

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Christian Clauss <[email protected]>

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Christian Clauss <[email protected]>

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <[email protected]>
Co-authored-by: Christian Clauss <[email protected]>
* Update scoring_functions.py

We can find accuracy by manually if we are not going to use sklearn library.

* Update scoring_functions.py

* Update machine_learning/scoring_functions.py

Co-authored-by: Christian Clauss <[email protected]>
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Create octal_to_decimal

octal to decimal converter

* Update octal_to_decimal

* Update conversions/octal_to_decimal

Co-authored-by: Christian Clauss <[email protected]>

Co-authored-by: Christian Clauss <[email protected]>
* Create binary_to_decimal

binary to decimal converter

* Update conversions/binary_to_decimal

Co-authored-by: Christian Clauss <[email protected]>

* Update binary_to_decimal

* Update conversions/binary_to_decimal

Co-authored-by: Christian Clauss <[email protected]>

* Update binary_to_decimal

Co-authored-by: Christian Clauss <[email protected]>
* Fix Non Recursive Depth First Search

* Unindent docstring

* Reindent docstring by 1 space

Co-authored-by: Christian Clauss <[email protected]>

Co-authored-by: Christian Clauss <[email protected]>
* lxmlCovidDataFetch

* lxmlCovidDataFetch1

* Update worldometers_covid_with_lxml.py

* Rename worldometers_covid_with_lxml.py to covid_stats_via_xpath.py

Co-authored-by: Christian Clauss <[email protected]>
* file-transfer: writing tests and ensuring that all is going well

* def send_file(filename: str = "mytext.txt", testing: bool = False) -> None:

* send_file(filename="mytext.txt", testing=True)

* Update send_file.py

* requirements.txt: lxml

Co-authored-by: Christian Clauss <[email protected]>
* jump_search: doctest, docstring, type hint, inputs

* jumpsearch.py: case number not found

* trailing whitespace jump search
* fix assignment of a variable to itself

* Fix unnecessary 'else' clause in loop

* formatting and redundant reasignment fix

* mark unreachable code with a TODO comment

* fix variable defined multiple times

* fix static method without static decorator

* revert unintended autoformatting

Co-authored-by: Christian Clauss <[email protected]>

* revert autoformatting issue

* applied black autoformatting

Co-authored-by: Christian Clauss <[email protected]>
* * Renamed files
* Fiexed doctest

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* * Added type hints
* Added test
* Formated code

* updating DIRECTORY.md

* Update stack.py

* Test error conditions for pop, peek, and

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <[email protected]>
* recaptchaVerification

* recaptchaVerification

* recaptchaVerification1

* recaptchaVerification2

* recaptchaVerification3

* recaptchaVerification4

* recaptchaVerificatio5

* recaptchaVerificatio5

* recaptchaVerificatio6

* drawOnVideoStreamOpenCV

* matrixInverseMCAmethod

* fixingImports

* recaptchaVerificationfixes

* recaptchaVerificationfixes

* recaptchaVerificationfixes

* recaptchaVerificationfixes

* recaptchaVerificationfixes1

* recaptchaVerificationfixes1

* authenticate = login = render = redirect = print

Co-authored-by: Christian Clauss <[email protected]>
cclauss and others added 4 commits September 19, 2020 07:25
* bin_to_octal

Converts binary values to the octal equivalent.

* Update bin_to_octal

* Update conversions/bin_to_octal

Co-authored-by: Christian Clauss <[email protected]>

* Update conversions/bin_to_octal

Co-authored-by: Du Yuanchao <[email protected]>

* Update conversions/bin_to_octal

Co-authored-by: Du Yuanchao <[email protected]>

* Update conversions/bin_to_octal

Co-authored-by: Du Yuanchao <[email protected]>

* Rename bin_to_octal to bin_to_octal.py

Co-authored-by: Christian Clauss <[email protected]>
Co-authored-by: Du Yuanchao <[email protected]>
* Update and rename bin_to_octal.py to binary_to_octal.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
…m a palindrome. (#2450)

* Added check_if_string_can_be_rearranged_as_palindrome function.

* Added counter implementation and benchmark function.

* flake changes

* Update and rename check_if_string_can_be_converted_to_palindrome.py to can_string_be_rearranged_as_palindrome.py

* Update can_string_be_rearranged_as_palindrome.py

* #

Co-authored-by: svedire <[email protected]>
Co-authored-by: Christian Clauss <[email protected]>

scores = [90, 23, 6, 33, 21, 65, 123, 34423]
Copy link
Member

Choose a reason for hiding this comment

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

These five lines show the user something when they run the program. Removing them means that the program shows the user nothing when run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cclauss thank you for your feedback, I have added these lines as method main, look at it if is it right way or not?

dhruvmanila and others added 6 commits September 20, 2020 13:52
* Add solution and test files for project euler 54

* Update sol1.py

* updating DIRECTORY.md

* Fix: use proper path to open files

* Commit suggestions:

- Use list comprehension instead of map
- Sort imports using isort

* Changes made as suggested (simplified a lot):

- List and set comprehension instead of itemgetter
- Using enumerate as it's easy to read
- Divided into list of card values and set of card suit as set will
  remove all the duplicate values. So, no need for double indexing.
- Add test for testing multiple calls to five_high_straight function

* Add suggestions and simplified:

- Split generate_random_hands function into two:
  - First will generate a random hand
  - Second, which will be called, will return a generator object

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* optimization for problem09 in project_euler

* added benchmark code

* fixup! Format Python code with psf/black push

* Update project_euler/problem_09/sol1.py

Co-authored-by: Christian Clauss <[email protected]>

* updating DIRECTORY.md

* Update project_euler/problem_09/sol1.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <[email protected]>
* Testing Travis CI configuration for project Euler

* Fix: Installing mypy and pytest-cov for testing

* Remove unnecessary checks for project_euler job

* Removing branches section

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

Co-authored-by: Christian Clauss <[email protected]>
* from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
@@ -1,4 +1,5 @@
from typing import List
Copy link
Member

Choose a reason for hiding this comment

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

Please rebase with master to pick up the #2464 changes.

spamegg1 and others added 12 commits September 23, 2020 21:55
* Add Python type hints and doctests to other/two_sum.py

#2465

* Update other/two_sum.py

Co-authored-by: Christian Clauss <[email protected]>

* Update other/two_sum.py

Co-authored-by: Christian Clauss <[email protected]>

* Update two_sum.py

Co-authored-by: Christian Clauss <[email protected]>
* Added binary_and_operator.py & binary_xor_operator.py

* Updated binary_and_operator.py

* Updated binary_xor_operator.py

* Updated binary_xor_operator.py
* updated reversed words

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* fixed remove duplicate

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Add solution() for problem 54 of Project Euler

* Add type hints for solution() function
@TravisBuddy
Copy link

Hey @abdujabbor,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: aa11d8b0-fe70-11ea-803e-573615702161

@Abdujabbar
Copy link
Contributor Author

@cclauss I can't understand why but after rebase there are a lot of other commits in my pull request, is it ok? or better to close this PR and send another with only my changes?

@cclauss cclauss closed this Sep 24, 2020
@cclauss
Copy link
Member

cclauss commented Sep 24, 2020

Please create a new PR with just one file changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.