Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ nosetests.xml
# Documentation
/htmldocs/

# Documentation
/htmldocs/

# Translations
*.mo

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.md LICENSE CHANGELOG.md tox.ini .coveragerc Makefile pytest.ini .tox-coveragerc
include README.md LICENSE CHANGELOG.md tox.ini pyproject.toml .coveragerc Makefile pytest.ini .tox-coveragerc
exclude TODO.md .appveyor.yml

graft docs
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build-system]

requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
Comment thread
mahmoud marked this conversation as resolved.
Resolved


[tool.black]

line-length = 80
target-version = ["py27"]
83 changes: 39 additions & 44 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,47 @@
from setuptools import find_packages, setup


__author__ = 'Mahmoud Hashemi and Glyph Lefkowitz'
__version__ = '19.0.1dev'
__contact__ = 'mahmoud@hatnote.com'
__url__ = 'https://github.com/python-hyper/hyperlink'
__license__ = 'MIT'
__author__ = "Mahmoud Hashemi and Glyph Lefkowitz"
__version__ = "19.0.1dev"
__contact__ = "mahmoud@hatnote.com"
__url__ = "https://github.com/python-hyper/hyperlink"
__license__ = "MIT"


setup(name='hyperlink',
version=__version__,
description="A featureful, immutable, and correct URL for Python.",
long_description=__doc__,
author=__author__,
author_email=__contact__,
url=__url__,
packages=find_packages(where="src"),
package_dir={"": "src"},
package_data=dict(
hyperlink=[
"py.typed",
],
),
zip_safe=False,
license=__license__,
platforms='any',
install_requires=[
'idna>=2.5',
'typing ; python_version<"3.5"',
],
python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
classifiers=[
'Topic :: Utilities',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: PyPy',
'License :: OSI Approved :: MIT License', ]
)
setup(
name="hyperlink",
version=__version__,
description="A featureful, immutable, and correct URL for Python.",
long_description=__doc__,
author=__author__,
author_email=__contact__,
url=__url__,
packages=find_packages(where="src"),
package_dir={"": "src"},
package_data=dict(hyperlink=["py.typed",],),
zip_safe=False,
license=__license__,
platforms="any",
install_requires=["idna>=2.5", 'typing ; python_version<"3.5"',],
python_requires=">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
classifiers=[
"Topic :: Utilities",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: PyPy",
"License :: OSI Approved :: MIT License",
],
)

"""
A brief checklist for release:
Expand Down
17 changes: 12 additions & 5 deletions src/hyperlink/_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from socket import inet_pton
except ImportError:
from typing import TYPE_CHECKING

if TYPE_CHECKING: # pragma: no cover
pass
else:
Expand All @@ -25,7 +26,7 @@ class SockAddr(ctypes.Structure):
def inet_pton(address_family, ip_string):
# type: (int, str) -> bytes
addr = SockAddr()
ip_string_bytes = ip_string.encode('ascii')
ip_string_bytes = ip_string.encode("ascii")
addr.sa_family = address_family
addr_size = ctypes.c_int(ctypes.sizeof(addr))

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

if WSAStringToAddressA(
ip_string_bytes, address_family, None,
ctypes.byref(addr), ctypes.byref(addr_size)
) != 0:
if (
WSAStringToAddressA(
ip_string_bytes,
address_family,
None,
ctypes.byref(addr),
ctypes.byref(addr_size),
)
!= 0
):
raise socket.error(ctypes.FormatError())

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