Skip to content

Create blacklistipchecker.py - #9416

Closed
dimonalik wants to merge 40 commits into
TheAlgorithms:masterfrom
dimonalik:patch-7
Closed

Create blacklistipchecker.py#9416
dimonalik wants to merge 40 commits into
TheAlgorithms:masterfrom
dimonalik:patch-7

Conversation

@dimonalik

Copy link
Copy Markdown
Contributor

Describe your change:

  • 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 include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeperalgorithms-keeperBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

Comment threadother/blacklistipchecker.py Outdated
@algorithms-keeperalgorithms-keeperBot added the awaiting reviews This PR is ready to be reviewed label Oct 2, 2023
@algorithms-keeperalgorithms-keeperBot added the tests are failing Do not merge until tests pass label Oct 2, 2023
Comment threadother/blacklistipchecker.py Outdated
else:
try:
IP(x)
except:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OUCH!! A bare except!!

Comment threadother/blacklistipchecker.py Outdated
x = input()
try:
IP(x)
except:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AGAIN??

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

IPy literally works that way. I can easily fix it with
except Exception as ex:
print('Failed \n" + ex + 'Finishing \n")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Got it. I can fix it by using logging module. What should i do next?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Click details next to each of the failing ❌ tests below and try to get them to be green ✅

added logging for exceptions, fixed invalid var name,
@algorithms-keeperalgorithms-keeperBot added the require type hints https://docs.python.org/3/library/typing.html label Oct 2, 2023

@algorithms-keeperalgorithms-keeperBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

Comment threadother/blacklistipchecker.py Outdated
Comment threadother/blacklistipchecker.py Outdated
@algorithms-keeperalgorithms-keeperBot removed the require type hints https://docs.python.org/3/library/typing.html label Oct 2, 2023

@algorithms-keeperalgorithms-keeperBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

Comment threadother/blacklistipchecker.py Outdated
Fixed type hints, and list creation err

@algorithms-keeperalgorithms-keeperBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

Comment threadother/blacklistipchecker.py Outdated
@@ -0,0 +1,122 @@
######################################

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

An error occurred while parsing the file: other/blacklistipchecker.py

Traceback (mostrecentcalllast):
File"/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line146, inparsereports=lint_file(
^^^^^^^^^^libcst._exceptions.ParserSyntaxError: SyntaxError @ 1:1.tokenizererror: unterminatedstringliteral######################################^

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

dimonalikand others added 9 commits October 2, 2023 12:41
Fixed bunch of hasher in the beginning of file
Removed e-mail functionality to pass tests
Fixed deprecated type hints, sorted imports
Sorted imports with isort
Fixed some types mismatch
Comment threadother/blacklistipchecker.py Outdated
Co-authored-by: Christian Clauss <cclauss@me.com>
Comment threadother/blacklistipchecker.py Outdated

@algorithms-keeperalgorithms-keeperBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

link = f"https://api.blacklistchecker.com/check/{ip}"
result = requests.get(link, auth=(api_key, "")
result_dec = json.loads(result.content)
print(result_dec)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

An error occurred while parsing the file: other/blacklistipchecker.py

Traceback (mostrecentcalllast):
File"/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line146, inparsereports=lint_file(
^^^^^^^^^^libcst._exceptions.ParserSyntaxError: SyntaxError @ 20:16.parsererror: errorat19:15: expectedoneof!=, %, &, (, *, **, +, ,, -, ., /, //, <, <<, <=, ==, >, >=, >>, @, [, ^, and, if, in, is, not, or, |print(result_dec)
^

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

@algorithms-keeperalgorithms-keeperBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

link = f"https://api.blacklistchecker.com/check/{ip}"
result = requests.get(link, auth=(api_key, "")
result_dec = json.loads(result.content)
print(result_dec)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

An error occurred while parsing the file: other/blacklistipchecker.py

Traceback (mostrecentcalllast):
File"/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line146, inparsereports=lint_file(
^^^^^^^^^^libcst._exceptions.ParserSyntaxError: SyntaxError @ 20:16.parsererror: errorat19:15: expectedoneof!=, %, &, (, *, **, +, ,, -, ., /, //, <, <<, <=, ==, >, >=, >>, @, [, ^, and, if, in, is, not, or, |print(result_dec)
^

@algorithms-keeperalgorithms-keeperBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

detects = "!"
return (res, detects)
else result_dec.get("detections") != 0:
res = ip

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

An error occurred while parsing the file: other/blacklistipchecker.py

Traceback (mostrecentcalllast):
File"/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line146, inparsereports=lint_file(
^^^^^^^^^^libcst._exceptions.ParserSyntaxError: SyntaxError @ 26:17.parsererror: errorat25:19: expected :
res=ip^

@algorithms-keeperalgorithms-keeperBot added the tests are failing Do not merge until tests pass label Oct 2, 2023
added missing rightside comparison agrument
@algorithms-keeperalgorithms-keeperBot removed the tests are failing Do not merge until tests pass label Oct 2, 2023
@algorithms-keeperalgorithms-keeperBot mentioned this pull request Oct 2, 2023
14 tasks
@dimonalik

Copy link
Copy Markdown
ContributorAuthor

Who can review this PR? @cclauss help please

@algorithms-keeperalgorithms-keeperBot added the tests are failing Do not merge until tests pass label Oct 3, 2023
@algorithms-keeperalgorithms-keeperBot removed the tests are failing Do not merge until tests pass label Oct 4, 2023
@cclauss

Copy link
Copy Markdown
Member

This is a how-to-use, not an algorithm as discussed in CONTRIBUTING.md

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviewsThis PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@dimonalik@cclauss