Skip to content

Commit 2bdf9bf

Browse files
committed
Update to pass mypy checks
Make the changes necessary to successfully pass the mypy hook in our pre-commit configuration.
1 parent 22649ea commit 2bdf9bf

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ repos:
108108
rev: v0.931
109109
hooks:
110110
- id: mypy
111+
additional_dependencies:
112+
- types-pyOpenSSL
113+
- types-requests
111114
- repo: https://github.com/asottile/pyupgrade
112115
rev: v2.31.0
113116
hooks:

src/pshtt/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
"""The pshtt library."""
2+
# Standard Python Libraries
3+
from typing import List
4+
25
# We disable a Flake8 check for "Module imported but unused (F401)" here because
36
# although this import is not directly used, it populates the value
47
# package_name.__version__, which is used to get version information about this
58
# Python package.
69
from ._version import __version__ # noqa: F401
710

8-
__all__ = []
11+
__all__: List[str] = []

src/pshtt/pshtt.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@
1717
from . import utils
1818
from .models import Domain, Endpoint
1919

20-
try:
21-
# Standard Python Libraries
22-
from urllib import parse as urlparse # Python 3
23-
except ImportError:
20+
if sys.version_info.major == 2:
2421
# Third-Party Libraries
25-
import urlparse # Python 2
22+
import urlparse
23+
elif sys.version_info.major == 3:
24+
# Standard Python Libraries
25+
from urllib import parse as urlparse
2626

27-
try:
27+
if sys.version_info.major == 2:
28+
# Third-Party Libraries
29+
from urllib2 import URLError
30+
elif sys.version_info.major == 3:
2831
# Standard Python Libraries
2932
from urllib.error import URLError
30-
except ImportError:
31-
from urllib2 import URLError
3233

3334
# Third-Party Libraries
3435
import sslyze

0 commit comments

Comments
 (0)