Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mypy.ini, mypy-zope-plugin #357

Merged
merged 24 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d28b9df
reset author
Jun 1, 2021
3359fa3
resolved sqlite3 name for mypy
H-Shay Jun 2, 2021
544abc0
add type hints
H-Shay Jun 3, 2021
6c215c8
add type hints for mypy check
H-Shay Jun 3, 2021
1390086
add type hints to support mypy checks
H-Shay Jun 4, 2021
e0fdbe8
fix list import from typing
H-Shay Jun 4, 2021
3029212
fixed import and added changelog entry
H-Shay Jun 4, 2021
9398128
add changelog
H-Shay Jun 4, 2021
fae2511
requested changes
H-Shay Jun 7, 2021
c5cce38
implement requested changes on PR
H-Shay Jun 8, 2021
d7bde1b
reformat files with black and isort to pass lints
H-Shay Jun 8, 2021
8c21e7a
add mypy.ini, add mypy-zope-plugin, remove in-line type: ignore state…
H-Shay Jun 8, 2021
e618512
modify emailutils.py per this: https://github.com/matrix-org/sydent/p…
H-Shay Jun 8, 2021
1f4fa54
add changelog entry
H-Shay Jun 8, 2021
21d6aa6
fix flake8 lint fails
H-Shay Jun 9, 2021
d7347f5
Merge branch 'main' into add_mypy2
H-Shay Jun 9, 2021
80b524d
fix missing import statement
H-Shay Jun 9, 2021
19e9512
fix flake8 lint fail
H-Shay Jun 9, 2021
918ac78
update mypy and move mypy config to pyproject.toml
H-Shay Jun 10, 2021
38094dd
Merge branch 'main' into add_mypy2
H-Shay Jun 10, 2021
30d622e
reformat setup.py to pull in latest mypy-zope build
H-Shay Jun 10, 2021
d2add27
fix url for mypy-zope build in setup.py
H-Shay Jun 10, 2021
a32ef27
Update changelog, add mypy-zope plugin and add types for pyyaml and mock
H-Shay Jun 15, 2021
16c3d39
Revert "modify emailutils.py per this: https://github.com/matrix-org/…
H-Shay Jun 15, 2021
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
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, remove inline type-ignore comments, and update sydent/utils/emailutils.py.
21 changes: 20 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,23 @@
profile = "black"

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

[tool.mypy]
show_error_codes = true
namespace_packages = true
H-Shay marked this conversation as resolved.
Show resolved Hide resolved

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

2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def read(fname):
"flake8==3.9.2",
"black==21.5b1",
"isort==5.8.0",
"mypy>=0.900",
"mypy-zope @ https://[email protected]/Shoobx/mypy-zope/archive/391ce347b6c01dbc89e0194b62e47deadf53fbc6.tar.gz",
H-Shay marked this conversation as resolved.
Show resolved Hide resolved
],
# 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
4 changes: 1 addition & 3 deletions sydent/util/emailutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ def sendEmail(
smtp.quit()
except Exception as origException:
twisted.python.log.err()
ese = EmailSendException()
ese.cause = origException
raise ese
raise EmailSendException() from origException


class EmailAddressException(Exception):
Expand Down