Skip to content

Fix some warnings from LGTM #2420

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

Merged
merged 9 commits into from
Sep 13, 2020
Merged

Fix some warnings from LGTM #2420

merged 9 commits into from
Sep 13, 2020

Conversation

Hasenn
Copy link
Contributor

@Hasenn Hasenn commented Sep 13, 2020

Describe your change:

fixes minor issues : variables assigned to themselves, for - else without any break, redundant redefinitions ...

  • 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}.

@TravisBuddy
Copy link

Hey @Hasenn,
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: a51aa750-f58e-11ea-b8b5-77c9400cce29

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

cclauss commented Sep 13, 2020

Please run this PR thru psf/black. It knows how to format Python code.

@TravisBuddy
Copy link

Hey @Hasenn,
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: a925b2d0-f58f-11ea-b8b5-77c9400cce29

@@ -226,7 +226,9 @@ def has_cycle(self):
break
else:
return True
anticipating_nodes.add(stack[len_stack_minus_one])
# TODO:The following code is unreachable.
Copy link
Member

Choose a reason for hiding this comment

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

If code is unreachable then determine if the lines are useful. If they are then move the return statement below them. If they are not useful then delete them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i tried.. i can't read that part i don't really understand what it's supposed to do

Comment on lines 230 to 231
anticipating_nodes.add(
stack[len_stack_minus_one])
Copy link
Member

Choose a reason for hiding this comment

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

psf/black will undo this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah autopep8 did that, i've just pushed after running black

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

LGTM!

@cclauss cclauss merged commit 20e98fc into TheAlgorithms:master Sep 13, 2020
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* 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 <cclauss@me.com>

* revert autoformatting issue

* applied black autoformatting

Co-authored-by: Christian Clauss <cclauss@me.com>
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.

3 participants