Skip to content

Commit

Permalink
chore: add mypy (pypi#10874)
Browse files Browse the repository at this point in the history
* chore(deps): install mypy in lint.in

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* chore(deps): include more types-* packages for mypy

These were suggested from running mypy on the codebase.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* chore: configure mypy

Set configuration for mypy.

Exclude some of the subdirectories we are not interested in testing to
speed up mypy execution.

Ignore any 3rd party modules that we do not have types for yet.
Added links that I could find to help track completion.

Does **not** set `strict` mode yet, since that's a bigger lift.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* chore: add mypy runner script

Eventually this command should fold into `bin/lint` and be removed.

For now, it's a convenient execution wrapper.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: ignore dynamic properties

Callables are receiving dynamic attributes, something that isn't "usual".

See python/mypy#708

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: ignore lambdas

See python/mypy#4226

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: ignore hybrid_property repeat definitions

Part of the SQLAlchemy extensions, which do not yet have reliable
stubs/plugins.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: ignore sqlalchemy declarative

Should come along with sqlalchemy stubs.

See: https://docs.sqlalchemy.org/en/14/orm/extensions/mypy.html#using-declared-attr-and-declarative-mixins

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: a few more ignores

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: interface methods shouldn't use self

Surfaced via mypy, corrected!

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: correct subclass path

Surfaced via mypy, corrected.

Unclear why this wouldn't have been caught by other tools.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: rename internal variable

mypy detected this as a type mismatch, as the internal variable name was
shadowing the externally-supplied one, and changing the type.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: ignore flake8 line too long for ignored types

Adding a `# type: ignore` comment to a couple of places triggered
flake8's line too long check.

Running `make reformat` did nothing for these - black has outstanding
design issues with line length and comments.

See psf/black#1713 for one example.

Instead of changing the line structure to accommodate, ignore these two
cases, at least until the types can be fixed and the comments removed.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* Revert "chore: add mypy runner script"

This reverts commit fffeadb.

* test: include mypy in lint execution

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* chore(deps): include itsdangerous type stubs

Until itsdangerous 2.0 is included, this types package is needed.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
  • Loading branch information
miketheman authored and domdfcoding committed Jun 7, 2022
1 parent 37f2841 commit 047471d
Show file tree
Hide file tree
Showing 16 changed files with 257 additions and 26 deletions.
1 change: 1 addition & 0 deletions bin/lint
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ python -m black --check *.py warehouse/ tests/
python -m isort --check *.py warehouse/ tests/
python -m doc8 --allow-long-titles README.rst CONTRIBUTING.rst docs/ --ignore-path docs/_build/
python -m curlylint ./warehouse/templates
python -m mypy -p warehouse
51 changes: 51 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,57 @@ lines_between_types = 1
combine_as_imports = true
known_first_party = ['warehouse', 'tests']

[tool.mypy]
python_version = "3.9"
namespace_packages = true
warn_unused_configs = true
plugins = ["mypy_zope:plugin"]
exclude = ["warehouse/locale/.*", "warehouse/migrations/versions.*"]

[[tool.mypy.overrides]]
# These modules do not yet have types available.
module = [
"automat.*",
"babel.*",
"bpython.*",
"celery.app.backends.*",
"celery.backends.redis.*",
"citext.*",
"disposable_email_domains.*",
"elasticsearch_dsl.*", # https://github.com/elastic/elasticsearch-dsl-py/issues/1533
"google.cloud.*",
"IPython.*",
"mistune.*",
"msgpack.*",
"paginate.*",
"paginate_sqlalchemy.*",
"passlib.*",
"premailer.*",
"pymacaroons.*", # https://github.com/ecordell/pymacaroons/issues/41
"pyramid.*", # https://github.com/Pylons/pyramid/issues/2638
"pyramid_jinja2.*",
"pyramid_mailer.*",
"pyramid_multiauth.*",
"pyramid_retry.*",
"pyramid_rpc.*",
"pyqrcode.*",
"readme_renderer.*", # https://github.com/pypa/readme_renderer/issues/166
"requests_aws4auth.*",
"rfc3986.*",
"stdlib_list.*",
"sqlalchemy.*", # https://docs.sqlalchemy.org/en/14/orm/extensions/mypy.html
"sqlalchemy_utils.*",
"transaction.*",
"trove_classifiers.*",
"venusian.*",
"whitenoise.*",
"wtforms.*", # https://github.com/wtforms/wtforms/issues/618
"yara.*",
"zxcvbn.*", # https://github.com/dwolfhub/zxcvbn-python/issues/56
"zope.sqlalchemy.*",
]
ignore_missing_imports = true

[tool.pytest.ini_options]
norecursedirs = ['build', 'dist', 'node_modules', '*.egg-info', '.state requirements']
markers = [
Expand Down
14 changes: 14 additions & 0 deletions requirements/lint.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@ curlylint
pep8-naming
black==22.1.0
isort>=5
mypy
celery-types
mypy-zope
types-boto3
types-certifi
types-first
types-html5lib
types-itsdangerous
types-psycopg2
types-python-slugify
types-pytz
types-redis
types-requests
types-setuptools
171 changes: 168 additions & 3 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ black==22.1.0 \
--hash=sha256:f5660feab44c2e3cb24b2419b998846cbb01c23c7fe645fee45087efa3da2d61 \
--hash=sha256:fdb8754b453fb15fad3f72cd9cad3e16776f0964d67cf30ebcbf10327a3777a3
# via -r requirements/lint.in
boto3-stubs==1.21.13 \
--hash=sha256:4d490b296754e3bef8350b22be02d54590bfc1967e24e2e1e9d256f2ffbd5b82 \
--hash=sha256:5ede068ad7c8e426af0938ebcf5f417610a1745a387f9ceca1398c9da7956f08
# via types-boto3
botocore-stubs==1.24.13 \
--hash=sha256:d172f4dde2df15c90bb6926801fe8cc6fad4d91d094faf35c34f69b8203d2b57 \
--hash=sha256:eddcb423f18817cad8f4fcba4db8f24ebb21f16a5c0e28e09771099edb47fcce
# via boto3-stubs
celery-types==0.11.0 \
--hash=sha256:88a95c5513d62145583235ad03050352ed4b8294003d0a5a012c959c09ec68d3 \
--hash=sha256:95134cb0899c7cd1116edc8d8017e1fe156697247e9657e6cdf56ed362de56cb
# via -r requirements/lint.in
click==8.0.4 \
--hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \
--hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb
Expand Down Expand Up @@ -72,10 +84,40 @@ mccabe==0.6.1 \
--hash=sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42 \
--hash=sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f
# via flake8
mypy==0.931 \
--hash=sha256:0038b21890867793581e4cb0d810829f5fd4441aa75796b53033af3aa30430ce \
--hash=sha256:1171f2e0859cfff2d366da2c7092b06130f232c636a3f7301e3feb8b41f6377d \
--hash=sha256:1b06268df7eb53a8feea99cbfff77a6e2b205e70bf31743e786678ef87ee8069 \
--hash=sha256:1b65714dc296a7991000b6ee59a35b3f550e0073411ac9d3202f6516621ba66c \
--hash=sha256:1bf752559797c897cdd2c65f7b60c2b6969ffe458417b8d947b8340cc9cec08d \
--hash=sha256:300717a07ad09525401a508ef5d105e6b56646f7942eb92715a1c8d610149714 \
--hash=sha256:3c5b42d0815e15518b1f0990cff7a705805961613e701db60387e6fb663fe78a \
--hash=sha256:4365c60266b95a3f216a3047f1d8e3f895da6c7402e9e1ddfab96393122cc58d \
--hash=sha256:50c7346a46dc76a4ed88f3277d4959de8a2bd0a0fa47fa87a4cde36fe247ac05 \
--hash=sha256:5b56154f8c09427bae082b32275a21f500b24d93c88d69a5e82f3978018a0266 \
--hash=sha256:74f7eccbfd436abe9c352ad9fb65872cc0f1f0a868e9d9c44db0893440f0c697 \
--hash=sha256:7b3f6f557ba4afc7f2ce6d3215d5db279bcf120b3cfd0add20a5d4f4abdae5bc \
--hash=sha256:8c11003aaeaf7cc2d0f1bc101c1cc9454ec4cc9cb825aef3cafff8a5fdf4c799 \
--hash=sha256:8ca7f8c4b1584d63c9a0f827c37ba7a47226c19a23a753d52e5b5eddb201afcd \
--hash=sha256:c89702cac5b302f0c5d33b172d2b55b5df2bede3344a2fbed99ff96bddb2cf00 \
--hash=sha256:d8f1ff62f7a879c9fe5917b3f9eb93a79b78aad47b533911b853a757223f72e7 \
--hash=sha256:d9d2b84b2007cea426e327d2483238f040c49405a6bf4074f605f0156c91a47a \
--hash=sha256:e839191b8da5b4e5d805f940537efcaa13ea5dd98418f06dc585d2891d228cf0 \
--hash=sha256:f9fe20d0872b26c4bba1c1be02c5340de1019530302cf2dcc85c7f9fc3252ae0 \
--hash=sha256:ff3bf387c14c805ab1388185dd22d6b210824e164d4bb324b195ff34e322d166
# via
# -r requirements/lint.in
# mypy-zope
mypy-extensions==0.4.3 \
--hash=sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d \
--hash=sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8
# via black
# via
# black
# mypy
mypy-zope==0.3.5 \
--hash=sha256:3bd0cc9a3e5933b02931af4b214ba32a4f4ff98adb30c979ce733857db91a18b \
--hash=sha256:489e7da1c2af887f2cfe3496995fc247f296512b495b57817edddda9d22308f3
# via -r requirements/lint.in
parsy==1.1.0 \
--hash=sha256:25bd5cea2954950ebbfdf71f8bdaf7fd45a5df5325fd36a1064be2204d9d4c94 \
--hash=sha256:36173ba01a5372c7a1b32352cc73a279a49198f52252adf1c8c1ed41d1f94e8d
Expand Down Expand Up @@ -124,8 +166,131 @@ toml==0.10.2 \
tomli==2.0.1 \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
# via black
# via
# black
# mypy
types-boto3==1.0.1 \
--hash=sha256:392d5fdbb40ea0fb20f5116897e96b5e6c5b4a784e8c75aec1f5e12f2ebe3438 \
--hash=sha256:4eb8aad23d4287d2f5b30a36e742f108beab8e0d55eb73817fdce405b8eef95e
# via -r requirements/lint.in
types-certifi==2021.10.8.1 \
--hash=sha256:2290008f32e6ac7c69e779d04fa1bc4c6bb4c7200aa3b3b072ad5475a8968aa5 \
--hash=sha256:546cd3ca4466855959fbc8868fd7139a50eb55a2d1fae497e13b60af439597a3
# via -r requirements/lint.in
types-first==2.0.2 \
--hash=sha256:129155be97b4a65a86a2b4cbc6f2d1de5b40d2c5d370289779fd6dd0293b69f6 \
--hash=sha256:444b4eaba3342f3d360f9f49eb4a175538da212e31ed1f26ee9b54c23f5fa0de
# via -r requirements/lint.in
types-html5lib==1.1.5 \
--hash=sha256:15435ea831ee0fef4cca1382998d51c1e81447ccd38664baab4fb50249695372 \
--hash=sha256:6e190a4e466e3f96f2128fd936a10b1159a57142d01628b0c515f4fc48d2e094
# via -r requirements/lint.in
types-itsdangerous==1.1.6 \
--hash=sha256:21c6966c10e353a5d35d36c82aaa2c5598d3bc32ddc8e0591276da5ad2e3c638 \
--hash=sha256:aef2535c2fa0527dcce244ece0792b20ec02ee46533800735275f82a45a0244d
# via -r requirements/lint.in
types-psycopg2==2.9.7 \
--hash=sha256:90e9393c04ac29af7f000578629020b488f6435abb283d928c1bd8eabb846e14 \
--hash=sha256:cc876db5aa77773deb0abe2e5b088842b91163261294b36caaf7e1087e7e8cd2
# via -r requirements/lint.in
types-python-slugify==5.0.3 \
--hash=sha256:76169f4a6d40896fea76fb45a25c50ac7ba2ca03eee759ecac322a05fe4dd21c \
--hash=sha256:a5761d3c55e949f8ace0694eb5be81210087084bb78df495de14ee5eaad6ac54
# via -r requirements/lint.in
types-pytz==2021.3.5 \
--hash=sha256:8831f689379ac9e2a62668157381379ed74b3702980e08e71f8673c179c4e3c7 \
--hash=sha256:fef8de238ee95135952229a2a23bfb87bd63d5a6c8598106a46cfcf48f069ea8
# via -r requirements/lint.in
types-redis==4.1.17 \
--hash=sha256:5c8707423c60e70ba6ff9a5f01baacbb6c871e44f6a2bd562790cee9edd5b5b1 \
--hash=sha256:7e98c567f0e279b47b0a0ddee8c0180a086e4a5f1b95e6890b40b2a84dc97fb6
# via -r requirements/lint.in
types-requests==2.27.11 \
--hash=sha256:506279bad570c7b4b19ac1f22e50146538befbe0c133b2cea66a9b04a533a859 \
--hash=sha256:6a7ed24b21780af4a5b5e24c310b2cd885fb612df5fd95584d03d87e5f2a195a
# via -r requirements/lint.in
types-setuptools==57.4.9 \
--hash=sha256:536ef74744f8e1e4be4fc719887f886e74e4cf3c792b4a06984320be4df450b5 \
--hash=sha256:948dc6863373750e2cd0b223a84f1fb608414cde5e55cf38ea657b93aeb411d2
# via -r requirements/lint.in
types-urllib3==1.26.10 \
--hash=sha256:a26898f530e6c3f43f25b907f2b884486868ffd56a9faa94cbf9b3eb6e165d6a \
--hash=sha256:d755278d5ecd7a7a6479a190e54230f241f1a99c19b81518b756b19dc69e518c
# via types-requests
typing-extensions==4.1.1 \
--hash=sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42 \
--hash=sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2
# via black
# via
# black
# mypy
zope-event==4.5.0 \
--hash=sha256:2666401939cdaa5f4e0c08cf7f20c9b21423b95e88f4675b1443973bdb080c42 \
--hash=sha256:5e76517f5b9b119acf37ca8819781db6c16ea433f7e2062c4afc2b6fbedb1330
# via zope-schema
zope-interface==5.4.0 \
--hash=sha256:08f9636e99a9d5410181ba0729e0408d3d8748026ea938f3b970a0249daa8192 \
--hash=sha256:0b465ae0962d49c68aa9733ba92a001b2a0933c317780435f00be7ecb959c702 \
--hash=sha256:0cba8477e300d64a11a9789ed40ee8932b59f9ee05f85276dbb4b59acee5dd09 \
--hash=sha256:0cee5187b60ed26d56eb2960136288ce91bcf61e2a9405660d271d1f122a69a4 \
--hash=sha256:0ea1d73b7c9dcbc5080bb8aaffb776f1c68e807767069b9ccdd06f27a161914a \
--hash=sha256:0f91b5b948686659a8e28b728ff5e74b1be6bf40cb04704453617e5f1e945ef3 \
--hash=sha256:15e7d1f7a6ee16572e21e3576d2012b2778cbacf75eb4b7400be37455f5ca8bf \
--hash=sha256:17776ecd3a1fdd2b2cd5373e5ef8b307162f581c693575ec62e7c5399d80794c \
--hash=sha256:194d0bcb1374ac3e1e023961610dc8f2c78a0f5f634d0c737691e215569e640d \
--hash=sha256:1c0e316c9add0db48a5b703833881351444398b04111188069a26a61cfb4df78 \
--hash=sha256:205e40ccde0f37496904572035deea747390a8b7dc65146d30b96e2dd1359a83 \
--hash=sha256:273f158fabc5ea33cbc936da0ab3d4ba80ede5351babc4f577d768e057651531 \
--hash=sha256:2876246527c91e101184f63ccd1d716ec9c46519cc5f3d5375a3351c46467c46 \
--hash=sha256:2c98384b254b37ce50eddd55db8d381a5c53b4c10ee66e1e7fe749824f894021 \
--hash=sha256:2e5a26f16503be6c826abca904e45f1a44ff275fdb7e9d1b75c10671c26f8b94 \
--hash=sha256:334701327f37c47fa628fc8b8d28c7d7730ce7daaf4bda1efb741679c2b087fc \
--hash=sha256:3748fac0d0f6a304e674955ab1365d515993b3a0a865e16a11ec9d86fb307f63 \
--hash=sha256:3c02411a3b62668200910090a0dff17c0b25aaa36145082a5a6adf08fa281e54 \
--hash=sha256:3dd4952748521205697bc2802e4afac5ed4b02909bb799ba1fe239f77fd4e117 \
--hash=sha256:3f24df7124c323fceb53ff6168da70dbfbae1442b4f3da439cd441681f54fe25 \
--hash=sha256:469e2407e0fe9880ac690a3666f03eb4c3c444411a5a5fddfdabc5d184a79f05 \
--hash=sha256:4de4bc9b6d35c5af65b454d3e9bc98c50eb3960d5a3762c9438df57427134b8e \
--hash=sha256:5208ebd5152e040640518a77827bdfcc73773a15a33d6644015b763b9c9febc1 \
--hash=sha256:52de7fc6c21b419078008f697fd4103dbc763288b1406b4562554bd47514c004 \
--hash=sha256:5bb3489b4558e49ad2c5118137cfeaf59434f9737fa9c5deefc72d22c23822e2 \
--hash=sha256:5dba5f530fec3f0988d83b78cc591b58c0b6eb8431a85edd1569a0539a8a5a0e \
--hash=sha256:5dd9ca406499444f4c8299f803d4a14edf7890ecc595c8b1c7115c2342cadc5f \
--hash=sha256:5f931a1c21dfa7a9c573ec1f50a31135ccce84e32507c54e1ea404894c5eb96f \
--hash=sha256:63b82bb63de7c821428d513607e84c6d97d58afd1fe2eb645030bdc185440120 \
--hash=sha256:66c0061c91b3b9cf542131148ef7ecbecb2690d48d1612ec386de9d36766058f \
--hash=sha256:6f0c02cbb9691b7c91d5009108f975f8ffeab5dff8f26d62e21c493060eff2a1 \
--hash=sha256:71aace0c42d53abe6fc7f726c5d3b60d90f3c5c055a447950ad6ea9cec2e37d9 \
--hash=sha256:7d97a4306898b05404a0dcdc32d9709b7d8832c0c542b861d9a826301719794e \
--hash=sha256:7df1e1c05304f26faa49fa752a8c690126cf98b40b91d54e6e9cc3b7d6ffe8b7 \
--hash=sha256:8270252effc60b9642b423189a2fe90eb6b59e87cbee54549db3f5562ff8d1b8 \
--hash=sha256:867a5ad16892bf20e6c4ea2aab1971f45645ff3102ad29bd84c86027fa99997b \
--hash=sha256:877473e675fdcc113c138813a5dd440da0769a2d81f4d86614e5d62b69497155 \
--hash=sha256:8892f89999ffd992208754851e5a052f6b5db70a1e3f7d54b17c5211e37a98c7 \
--hash=sha256:9a9845c4c6bb56e508651f005c4aeb0404e518c6f000d5a1123ab077ab769f5c \
--hash=sha256:a1e6e96217a0f72e2b8629e271e1b280c6fa3fe6e59fa8f6701bec14e3354325 \
--hash=sha256:a8156e6a7f5e2a0ff0c5b21d6bcb45145efece1909efcbbbf48c56f8da68221d \
--hash=sha256:a9506a7e80bcf6eacfff7f804c0ad5350c8c95b9010e4356a4b36f5322f09abb \
--hash=sha256:af310ec8335016b5e52cae60cda4a4f2a60a788cbb949a4fbea13d441aa5a09e \
--hash=sha256:b0297b1e05fd128d26cc2460c810d42e205d16d76799526dfa8c8ccd50e74959 \
--hash=sha256:bf68f4b2b6683e52bec69273562df15af352e5ed25d1b6641e7efddc5951d1a7 \
--hash=sha256:d0c1bc2fa9a7285719e5678584f6b92572a5b639d0e471bb8d4b650a1a910920 \
--hash=sha256:d4d9d6c1a455d4babd320203b918ccc7fcbefe308615c521062bc2ba1aa4d26e \
--hash=sha256:db1fa631737dab9fa0b37f3979d8d2631e348c3b4e8325d6873c2541d0ae5a48 \
--hash=sha256:dd93ea5c0c7f3e25335ab7d22a507b1dc43976e1345508f845efc573d3d779d8 \
--hash=sha256:f44e517131a98f7a76696a7b21b164bcb85291cee106a23beccce454e1f433a4 \
--hash=sha256:f7ee479e96f7ee350db1cf24afa5685a5899e2b34992fb99e1f7c1b0b758d263
# via
# mypy-zope
# zope-schema
zope-schema==6.2.0 \
--hash=sha256:03150d8670549590b45109e06b7b964f4e751fa9cb5297ec4985c3bc38641b07 \
--hash=sha256:2201aef8ad75ee5a881284d7a6acd384661d6dca7bde5e80a22839a77124595b
# via mypy-zope

# The following packages are considered to be unsafe in a requirements file:
setuptools==60.9.3 \
--hash=sha256:2347b2b432c891a863acadca2da9ac101eae6169b1d3dfee2ec605ecd50dbfe5 \
--hash=sha256:e4f30b9f84e5ab3decf945113119649fec09c1fc3507c6ebffec75646c56e62b
# via
# zope-interface
# zope-schema
2 changes: 1 addition & 1 deletion warehouse/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def email(self):
primary_email = self.primary_email
return primary_email.email if primary_email else None

@email.expression
@email.expression # type: ignore
def email(self):
return (
select([Email.email])
Expand Down
2 changes: 1 addition & 1 deletion warehouse/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ def warehouse(ctx):

# We want to automatically import all of the warehouse.cli.* modules so that
# any commands registered in any of them will be discovered.
for _, name, _ in pkgutil.walk_packages(__path__, prefix=__name__ + "."):
for _, name, _ in pkgutil.walk_packages(__path__, prefix=__name__ + "."): # type: ignore # noqa
importlib.import_module(name)
2 changes: 1 addition & 1 deletion warehouse/csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def wrapped(context, request):
return wrapped


require_method_view.options = {"require_methods"}
require_method_view.options = {"require_methods"} # type: ignore


def includeme(config):
Expand Down
4 changes: 2 additions & 2 deletions warehouse/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from sqlalchemy import event, inspect
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.exc import IntegrityError, OperationalError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declarative_base # type: ignore
from sqlalchemy.orm import sessionmaker

from warehouse.metrics import IMetricsService
Expand Down Expand Up @@ -97,7 +97,7 @@ def __repr__(self):


# Base class for models using declarative syntax
ModelBase = declarative_base(cls=ModelBase, metadata=metadata)
ModelBase = declarative_base(cls=ModelBase, metadata=metadata) # type: ignore


class Model(ModelBase):
Expand Down
2 changes: 1 addition & 1 deletion warehouse/email/ses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class EmailMessage(db.Model):
backref="email",
cascade="all, delete-orphan",
lazy=False,
order_by=lambda: Event.created,
order_by=lambda: Event.created, # type: ignore
)


Expand Down
2 changes: 1 addition & 1 deletion warehouse/i18n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def wrapped(context, request):
return wrapped


translated_view.options = {"has_translations"}
translated_view.options = {"has_translations"} # type: ignore


def includeme(config):
Expand Down
2 changes: 1 addition & 1 deletion warehouse/legacy/api/xmlrpc/cache/derivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def wrapper_view(context, request):
return view


cached_return_view.options = [
cached_return_view.options = [ # type: ignore
"xmlrpc_cache",
"xmlrpc_cache_tag",
"xmlrpc_cache_expires",
Expand Down
6 changes: 3 additions & 3 deletions warehouse/legacy/api/xmlrpc/cache/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create_service(context, request):
created for.
"""

def fetch(self, func, args, kwargs, key, tag, expire):
def fetch(func, args, kwargs, key, tag, expire):
"""
Gets cached function return value from the cache or calls func with the
supplied args and kwargs, stashing it in the cache. Cache is drawn from
Expand All @@ -33,13 +33,13 @@ def fetch(self, func, args, kwargs, key, tag, expire):
expiration.
"""

def purge(self, tag):
def purge(tag):
"""
Issues a purge, clearing all cached objects associated with the tag
from the cache.
"""

def purge_tags(self, tags):
def purge_tags(tags):
"""
Issues a purge, clearing all cached objects associated with each tag
in the iterable tags.
Expand Down
Loading

0 comments on commit 047471d

Please sign in to comment.