Skip to content

Commit

Permalink
Use black
Browse files Browse the repository at this point in the history
  • Loading branch information
boramalper committed Aug 3, 2020
1 parent 9b880d8 commit 0330992
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
7 changes: 7 additions & 0 deletions black.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

python -m black \
--line-length 120 \
--target-version py35 \
--exclude "/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist|migrations)/" \
.
12 changes: 7 additions & 5 deletions nm_iconfinder/nm_iconfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ def icons(url: str) -> List[Icon]:
return []

soup = BeautifulSoup(response.text, features="lxml")
links = soup.find_all("link", attrs={"rel": "shortcut icon", "href": True}) \
+ soup.find_all("link", attrs={"rel": "icon", "href": True}) \
+ soup.find_all("link", attrs={"rel": "apple-touch-icon-precomposed", "href": True}) \
+ soup.find_all("link", attrs={"rel": "apple-touch-icon", "href": True}) \
+ [{"href": "/favicon.ico"}]
links = (
soup.find_all("link", attrs={"rel": "shortcut icon", "href": True})
+ soup.find_all("link", attrs={"rel": "icon", "href": True})
+ soup.find_all("link", attrs={"rel": "apple-touch-icon-precomposed", "href": True})
+ soup.find_all("link", attrs={"rel": "apple-touch-icon", "href": True})
+ [{"href": "/favicon.ico"}]
)
hrefs = set(urljoin(url, link["href"]) for link in links)

icons_ = [Icon.from_url(urljoin(url, href), sesh) for href in hrefs] # type: List[Optional[Icon]]
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
twine
twine==3.2.0
black==19.10b0
35 changes: 15 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
from distutils.core import setup

setup(
name='nm_iconfinder',
packages=['nm_iconfinder'],
version='0.1.2',
license='ISC',
description='Find icons of a website given a URL',
author='newsmail.today',
author_email='us@newsmail.today',
url='https://github.com/newsmail-today/iconfinder',
keywords=['icon', 'favicon', 'newsmail'],
install_requires=[
"beautifulsoup4",
"lxml",
"Pillow",
"requests",
],
name="nm_iconfinder",
packages=["nm_iconfinder"],
version="0.1.2",
license="ISC",
description="Find icons of a website given a URL",
author="newsmail.today",
author_email="us@newsmail.today",
url="https://github.com/newsmail-today/iconfinder",
keywords=["icon", "favicon", "newsmail"],
install_requires=["beautifulsoup4", "lxml", "Pillow", "requests",],
classifiers=[
# Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: ISC License (ISCL)',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: ISC License (ISCL)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
],
)

0 comments on commit 0330992

Please sign in to comment.