Skip to content

Commit 0153229

Browse files
authored
Merge pull request #106 from python-hyper/black
Fade to black
2 parents 563980a + f53dc66 commit 0153229

13 files changed

+1344
-994
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ nosetests.xml
4242
# Documentation
4343
/htmldocs/
4444

45+
# Documentation
46+
/htmldocs/
47+
4548
# Translations
4649
*.mo
4750

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include README.md LICENSE CHANGELOG.md tox.ini .coveragerc Makefile pytest.ini .tox-coveragerc
1+
include README.md LICENSE CHANGELOG.md tox.ini pyproject.toml .coveragerc Makefile pytest.ini .tox-coveragerc
22
exclude TODO.md .appveyor.yml
33

44
graft docs

pyproject.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[build-system]
2+
3+
requires = ["setuptools", "wheel"]
4+
build-backend = "setuptools.build_meta"
5+
6+
7+
[tool.black]
8+
9+
line-length = 80
10+
target-version = ["py27"]

setup.py

+39-44
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,47 @@
1010
from setuptools import find_packages, setup
1111

1212

13-
__author__ = 'Mahmoud Hashemi and Glyph Lefkowitz'
14-
__version__ = '19.0.1dev'
15-
__contact__ = '[email protected]'
16-
__url__ = 'https://github.com/python-hyper/hyperlink'
17-
__license__ = 'MIT'
13+
__author__ = "Mahmoud Hashemi and Glyph Lefkowitz"
14+
__version__ = "19.0.1dev"
15+
__contact__ = "[email protected]"
16+
__url__ = "https://github.com/python-hyper/hyperlink"
17+
__license__ = "MIT"
1818

1919

20-
setup(name='hyperlink',
21-
version=__version__,
22-
description="A featureful, immutable, and correct URL for Python.",
23-
long_description=__doc__,
24-
author=__author__,
25-
author_email=__contact__,
26-
url=__url__,
27-
packages=find_packages(where="src"),
28-
package_dir={"": "src"},
29-
package_data=dict(
30-
hyperlink=[
31-
"py.typed",
32-
],
33-
),
34-
zip_safe=False,
35-
license=__license__,
36-
platforms='any',
37-
install_requires=[
38-
'idna>=2.5',
39-
'typing ; python_version<"3.5"',
40-
],
41-
python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
42-
classifiers=[
43-
'Topic :: Utilities',
44-
'Intended Audience :: Developers',
45-
'Topic :: Software Development :: Libraries',
46-
'Development Status :: 5 - Production/Stable',
47-
'Programming Language :: Python :: 2',
48-
'Programming Language :: Python :: 2.6',
49-
'Programming Language :: Python :: 2.7',
50-
'Programming Language :: Python :: 3',
51-
'Programming Language :: Python :: 3.4',
52-
'Programming Language :: Python :: 3.5',
53-
'Programming Language :: Python :: 3.6',
54-
'Programming Language :: Python :: 3.7',
55-
'Programming Language :: Python :: 3.8',
56-
'Programming Language :: Python :: Implementation :: PyPy',
57-
'License :: OSI Approved :: MIT License', ]
58-
)
20+
setup(
21+
name="hyperlink",
22+
version=__version__,
23+
description="A featureful, immutable, and correct URL for Python.",
24+
long_description=__doc__,
25+
author=__author__,
26+
author_email=__contact__,
27+
url=__url__,
28+
packages=find_packages(where="src"),
29+
package_dir={"": "src"},
30+
package_data=dict(hyperlink=["py.typed",],),
31+
zip_safe=False,
32+
license=__license__,
33+
platforms="any",
34+
install_requires=["idna>=2.5", 'typing ; python_version<"3.5"',],
35+
python_requires=">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
36+
classifiers=[
37+
"Topic :: Utilities",
38+
"Intended Audience :: Developers",
39+
"Topic :: Software Development :: Libraries",
40+
"Development Status :: 5 - Production/Stable",
41+
"Programming Language :: Python :: 2",
42+
"Programming Language :: Python :: 2.6",
43+
"Programming Language :: Python :: 2.7",
44+
"Programming Language :: Python :: 3",
45+
"Programming Language :: Python :: 3.4",
46+
"Programming Language :: Python :: 3.5",
47+
"Programming Language :: Python :: 3.6",
48+
"Programming Language :: Python :: 3.7",
49+
"Programming Language :: Python :: 3.8",
50+
"Programming Language :: Python :: Implementation :: PyPy",
51+
"License :: OSI Approved :: MIT License",
52+
],
53+
)
5954

6055
"""
6156
A brief checklist for release:

src/hyperlink/_socket.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from socket import inet_pton
33
except ImportError:
44
from typing import TYPE_CHECKING
5+
56
if TYPE_CHECKING: # pragma: no cover
67
pass
78
else:
@@ -25,7 +26,7 @@ class SockAddr(ctypes.Structure):
2526
def inet_pton(address_family, ip_string):
2627
# type: (int, str) -> bytes
2728
addr = SockAddr()
28-
ip_string_bytes = ip_string.encode('ascii')
29+
ip_string_bytes = ip_string.encode("ascii")
2930
addr.sa_family = address_family
3031
addr_size = ctypes.c_int(ctypes.sizeof(addr))
3132

@@ -37,10 +38,16 @@ def inet_pton(address_family, ip_string):
3738
except KeyError:
3839
raise socket.error("unknown address family")
3940

40-
if WSAStringToAddressA(
41-
ip_string_bytes, address_family, None,
42-
ctypes.byref(addr), ctypes.byref(addr_size)
43-
) != 0:
41+
if (
42+
WSAStringToAddressA(
43+
ip_string_bytes,
44+
address_family,
45+
None,
46+
ctypes.byref(addr),
47+
ctypes.byref(addr_size),
48+
)
49+
!= 0
50+
):
4451
raise socket.error(ctypes.FormatError())
4552

4653
return ctypes.string_at(getattr(addr, attribute), size)

0 commit comments

Comments
 (0)