Skip to content

Commit

Permalink
Add mypy config and mypy-zope-plugin (#357)
Browse files Browse the repository at this point in the history
Signed-off-by: H.Shay <[email protected]>
  • Loading branch information
H-Shay authored Jun 15, 2021
1 parent dcdca9c commit 56fbed0
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/357.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a mypy.ini and add missing modules to ignore, add mypy-zope plugin, and remove inline type-ignore comments.
22 changes: 21 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,24 @@
profile = "black"

[tool.black]
target-version = ['py36']
target-version = ['py36']

[tool.mypy]
plugins = "mypy_zope:plugin"
show_error_codes = true
namespace_packages = true

[[tool.mypy.overrides]]
module = [
"idna",
"nacl.*",
"netaddr",
"OpenSSL",
"prometheus_client",
"phonenumbers",
"signedjson.*",
"sortedcontainers",
"unpaddedbase64"
]
ignore_missing_imports = true

4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def read(fname):
"flake8==3.9.2",
"black==21.5b1",
"isort==5.8.0",
"mypy>=0.902",
"mypy-zope>=0.3.1",
"types-PyYAML",
"types-mock",
],
# make sure we package the sql files
include_package_data=True,
Expand Down
1 change: 1 addition & 0 deletions sydent/db/threepid_associations.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
if TYPE_CHECKING:
from sydent.sydent import Sydent


logger = logging.getLogger(__name__)


Expand Down
2 changes: 1 addition & 1 deletion sydent/hs_federation/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from signedjson.sign import SignatureVerifyException
from twisted.internet import defer
from twisted.web.server import Request
from unpaddedbase64 import decode_base64 # type: ignore
from unpaddedbase64 import decode_base64

from sydent.http.httpclient import FederationHttpClient
from sydent.util.stringutils import is_valid_matrix_server_name
Expand Down
2 changes: 1 addition & 1 deletion sydent/replication/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from twisted.internet.defer import Deferred
from twisted.web.client import readBody
from twisted.web.iweb import IResponse
from unpaddedbase64 import decode_base64 # type: ignore
from unpaddedbase64 import decode_base64

from sydent.config import ConfigError
from sydent.db.hashing_metadata import HashingMetadataStore
Expand Down
2 changes: 1 addition & 1 deletion sydent/threepid/signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from typing import TYPE_CHECKING, Any, Dict

import signedjson.sign # type: ignore
import signedjson.sign

if TYPE_CHECKING:
from sydent.sydent import Sydent
Expand Down

0 comments on commit 56fbed0

Please sign in to comment.