forked fromsybrenstuvel/python-rsa
- Notifications
You must be signed in to change notification settings - Fork0
Commit7bdbdaa
Fix hashlib mypy types for Python 3.x
As captured inpython/typeshed#1663, the types forSHA-1 and SHA-2 family of functions are callables that return a Hash instance,whilst the SHA-3 family of functions are Hash `type`s (at least in Python 3.6).Mixing the two kinds of functions together in a dictionary confuses mypy's typeinference as noted insybrenstuvel#153, so we instead add an annotation as a hint.Also, update test_my.py to match the python version set by tox.ini in CIinstead of always targeting Python 3.7 (as configured in setup.cfg) tovalidate the types in all supported Python 3.x versions.This fix also avoids the issue with the older mypy releases forPython 3.6 / Python 3.7 found in distro repos...... for Ubuntu:```docker run \ -v $(pwd):/tmp/rsa \ -w /tmp/rsa ubuntu:18.04 \ /bin/bash -c 'apt-get update -qqy \ && apt-get install -qqy python3-pyasn1 python3-setuptools python3-mypy \ && python3 setup.py test'```... and for Fedora:```docker run \ -v $(pwd):/tmp/rsa \ -w /tmp/rsa docker.io/fedora \ /bin/bash -c 'dnf -y install wget python3-devel python3-pyasn1 python3-setuptools python3-mypy \ && python3 setup.py test'```Fixessybrenstuvel#1531 parent72f8f72 commit7bdbdaa
3 files changed
+16
-3
lines changedLines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
| 4 | + | |
| 5 | + | |
4 | 6 |
| |
5 | 7 |
| |
| 8 | + | |
| 9 | + |
Lines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 |
| |
38 | 43 |
| |
39 | 44 |
| |
| |||
44 | 49 |
| |
45 | 50 |
| |
46 | 51 |
| |
47 |
| - | |
| 52 | + | |
48 | 53 |
| |
49 | 54 |
| |
50 | 55 |
| |
|
Lines changed: 6 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
| 2 | + | |
2 | 3 |
| |
3 | 4 |
| |
4 | 5 |
| |
| |||
9 | 10 |
| |
10 | 11 |
| |
11 | 12 |
| |
12 |
| - | |
13 |
| - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 |
| |
15 | 19 |
| |
16 | 20 |
| |
|
0 commit comments
Comments
(0)