mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
Enable ruff SIM102 rule (#11341)
* Enable ruff SIM102 rule * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -30,12 +30,15 @@ class Parser(HTMLParser):
|
||||
if tag == "a":
|
||||
# Check the list of defined attributes.
|
||||
for name, value in attrs:
|
||||
# If href is defined, and not empty nor # print it.
|
||||
if name == "href" and value != "#" and value != "":
|
||||
# If not already in urls.
|
||||
if value not in self.urls:
|
||||
url = parse.urljoin(self.domain, value)
|
||||
self.urls.append(url)
|
||||
# If href is defined, not empty nor # print it and not already in urls.
|
||||
if (
|
||||
name == "href"
|
||||
and value != "#"
|
||||
and value != ""
|
||||
and value not in self.urls
|
||||
):
|
||||
url = parse.urljoin(self.domain, value)
|
||||
self.urls.append(url)
|
||||
|
||||
|
||||
# Get main domain name (example.com)
|
||||
|
Reference in New Issue
Block a user