Skip to content

Commit 83208c5

Browse files
authored
chore: add mypy (#10874)
* chore(deps): install mypy in lint.in Signed-off-by: Mike Fiedler <[email protected]> * chore(deps): include more types-* packages for mypy These were suggested from running mypy on the codebase. Signed-off-by: Mike Fiedler <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * lint: ignore dynamic properties Callables are receiving dynamic attributes, something that isn't "usual". See python/mypy#708 Signed-off-by: Mike Fiedler <[email protected]> * lint: ignore lambdas See python/mypy#4226 Signed-off-by: Mike Fiedler <[email protected]> * lint: ignore hybrid_property repeat definitions Part of the SQLAlchemy extensions, which do not yet have reliable stubs/plugins. Signed-off-by: Mike Fiedler <[email protected]> * 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 <[email protected]> * lint: a few more ignores Signed-off-by: Mike Fiedler <[email protected]> * lint: interface methods shouldn't use self Surfaced via mypy, corrected! Signed-off-by: Mike Fiedler <[email protected]> * lint: correct subclass path Surfaced via mypy, corrected. Unclear why this wouldn't have been caught by other tools. Signed-off-by: Mike Fiedler <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * Revert "chore: add mypy runner script" This reverts commit fffeadb. * test: include mypy in lint execution Signed-off-by: Mike Fiedler <[email protected]> * chore(deps): include itsdangerous type stubs Until itsdangerous 2.0 is included, this types package is needed. Signed-off-by: Mike Fiedler <[email protected]>
1 parent 10acd5e commit 83208c5

File tree

16 files changed

+257
-26
lines changed

16 files changed

+257
-26
lines changed

bin/lint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ python -m black --check *.py warehouse/ tests/
1616
python -m isort --check *.py warehouse/ tests/
1717
python -m doc8 --allow-long-titles README.rst CONTRIBUTING.rst docs/ --ignore-path docs/_build/
1818
python -m curlylint ./warehouse/templates
19+
python -m mypy -p warehouse

pyproject.toml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,57 @@ lines_between_types = 1
88
combine_as_imports = true
99
known_first_party = ['warehouse', 'tests']
1010

11+
[tool.mypy]
12+
python_version = "3.9"
13+
namespace_packages = true
14+
warn_unused_configs = true
15+
plugins = ["mypy_zope:plugin"]
16+
exclude = ["warehouse/locale/.*", "warehouse/migrations/versions.*"]
17+
18+
[[tool.mypy.overrides]]
19+
# These modules do not yet have types available.
20+
module = [
21+
"automat.*",
22+
"babel.*",
23+
"bpython.*",
24+
"celery.app.backends.*",
25+
"celery.backends.redis.*",
26+
"citext.*",
27+
"disposable_email_domains.*",
28+
"elasticsearch_dsl.*", # https://github.com/elastic/elasticsearch-dsl-py/issues/1533
29+
"google.cloud.*",
30+
"IPython.*",
31+
"mistune.*",
32+
"msgpack.*",
33+
"paginate.*",
34+
"paginate_sqlalchemy.*",
35+
"passlib.*",
36+
"premailer.*",
37+
"pymacaroons.*", # https://github.com/ecordell/pymacaroons/issues/41
38+
"pyramid.*", # https://github.com/Pylons/pyramid/issues/2638
39+
"pyramid_jinja2.*",
40+
"pyramid_mailer.*",
41+
"pyramid_multiauth.*",
42+
"pyramid_retry.*",
43+
"pyramid_rpc.*",
44+
"pyqrcode.*",
45+
"readme_renderer.*", # https://github.com/pypa/readme_renderer/issues/166
46+
"requests_aws4auth.*",
47+
"rfc3986.*",
48+
"stdlib_list.*",
49+
"sqlalchemy.*", # https://docs.sqlalchemy.org/en/14/orm/extensions/mypy.html
50+
"sqlalchemy_utils.*",
51+
"transaction.*",
52+
"trove_classifiers.*",
53+
"venusian.*",
54+
"whitenoise.*",
55+
"wtforms.*", # https://github.com/wtforms/wtforms/issues/618
56+
"yara.*",
57+
"zxcvbn.*", # https://github.com/dwolfhub/zxcvbn-python/issues/56
58+
"zope.sqlalchemy.*",
59+
]
60+
ignore_missing_imports = true
61+
1162
[tool.pytest.ini_options]
1263
norecursedirs = ['build', 'dist', 'node_modules', '*.egg-info', '.state requirements']
1364
markers = [

requirements/lint.in

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,17 @@ curlylint
44
pep8-naming
55
black==22.1.0
66
isort>=5
7+
mypy
8+
celery-types
9+
mypy-zope
10+
types-boto3
11+
types-certifi
12+
types-first
13+
types-html5lib
14+
types-itsdangerous
15+
types-psycopg2
16+
types-python-slugify
17+
types-pytz
18+
types-redis
19+
types-requests
20+
types-setuptools

requirements/lint.txt

Lines changed: 168 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ black==22.1.0 \
3333
--hash=sha256:f5660feab44c2e3cb24b2419b998846cbb01c23c7fe645fee45087efa3da2d61 \
3434
--hash=sha256:fdb8754b453fb15fad3f72cd9cad3e16776f0964d67cf30ebcbf10327a3777a3
3535
# via -r requirements/lint.in
36+
boto3-stubs==1.21.13 \
37+
--hash=sha256:4d490b296754e3bef8350b22be02d54590bfc1967e24e2e1e9d256f2ffbd5b82 \
38+
--hash=sha256:5ede068ad7c8e426af0938ebcf5f417610a1745a387f9ceca1398c9da7956f08
39+
# via types-boto3
40+
botocore-stubs==1.24.13 \
41+
--hash=sha256:d172f4dde2df15c90bb6926801fe8cc6fad4d91d094faf35c34f69b8203d2b57 \
42+
--hash=sha256:eddcb423f18817cad8f4fcba4db8f24ebb21f16a5c0e28e09771099edb47fcce
43+
# via boto3-stubs
44+
celery-types==0.11.0 \
45+
--hash=sha256:88a95c5513d62145583235ad03050352ed4b8294003d0a5a012c959c09ec68d3 \
46+
--hash=sha256:95134cb0899c7cd1116edc8d8017e1fe156697247e9657e6cdf56ed362de56cb
47+
# via -r requirements/lint.in
3648
click==8.0.4 \
3749
--hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \
3850
--hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb
@@ -72,10 +84,40 @@ mccabe==0.6.1 \
7284
--hash=sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42 \
7385
--hash=sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f
7486
# via flake8
87+
mypy==0.931 \
88+
--hash=sha256:0038b21890867793581e4cb0d810829f5fd4441aa75796b53033af3aa30430ce \
89+
--hash=sha256:1171f2e0859cfff2d366da2c7092b06130f232c636a3f7301e3feb8b41f6377d \
90+
--hash=sha256:1b06268df7eb53a8feea99cbfff77a6e2b205e70bf31743e786678ef87ee8069 \
91+
--hash=sha256:1b65714dc296a7991000b6ee59a35b3f550e0073411ac9d3202f6516621ba66c \
92+
--hash=sha256:1bf752559797c897cdd2c65f7b60c2b6969ffe458417b8d947b8340cc9cec08d \
93+
--hash=sha256:300717a07ad09525401a508ef5d105e6b56646f7942eb92715a1c8d610149714 \
94+
--hash=sha256:3c5b42d0815e15518b1f0990cff7a705805961613e701db60387e6fb663fe78a \
95+
--hash=sha256:4365c60266b95a3f216a3047f1d8e3f895da6c7402e9e1ddfab96393122cc58d \
96+
--hash=sha256:50c7346a46dc76a4ed88f3277d4959de8a2bd0a0fa47fa87a4cde36fe247ac05 \
97+
--hash=sha256:5b56154f8c09427bae082b32275a21f500b24d93c88d69a5e82f3978018a0266 \
98+
--hash=sha256:74f7eccbfd436abe9c352ad9fb65872cc0f1f0a868e9d9c44db0893440f0c697 \
99+
--hash=sha256:7b3f6f557ba4afc7f2ce6d3215d5db279bcf120b3cfd0add20a5d4f4abdae5bc \
100+
--hash=sha256:8c11003aaeaf7cc2d0f1bc101c1cc9454ec4cc9cb825aef3cafff8a5fdf4c799 \
101+
--hash=sha256:8ca7f8c4b1584d63c9a0f827c37ba7a47226c19a23a753d52e5b5eddb201afcd \
102+
--hash=sha256:c89702cac5b302f0c5d33b172d2b55b5df2bede3344a2fbed99ff96bddb2cf00 \
103+
--hash=sha256:d8f1ff62f7a879c9fe5917b3f9eb93a79b78aad47b533911b853a757223f72e7 \
104+
--hash=sha256:d9d2b84b2007cea426e327d2483238f040c49405a6bf4074f605f0156c91a47a \
105+
--hash=sha256:e839191b8da5b4e5d805f940537efcaa13ea5dd98418f06dc585d2891d228cf0 \
106+
--hash=sha256:f9fe20d0872b26c4bba1c1be02c5340de1019530302cf2dcc85c7f9fc3252ae0 \
107+
--hash=sha256:ff3bf387c14c805ab1388185dd22d6b210824e164d4bb324b195ff34e322d166
108+
# via
109+
# -r requirements/lint.in
110+
# mypy-zope
75111
mypy-extensions==0.4.3 \
76112
--hash=sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d \
77113
--hash=sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8
78-
# via black
114+
# via
115+
# black
116+
# mypy
117+
mypy-zope==0.3.5 \
118+
--hash=sha256:3bd0cc9a3e5933b02931af4b214ba32a4f4ff98adb30c979ce733857db91a18b \
119+
--hash=sha256:489e7da1c2af887f2cfe3496995fc247f296512b495b57817edddda9d22308f3
120+
# via -r requirements/lint.in
79121
parsy==1.1.0 \
80122
--hash=sha256:25bd5cea2954950ebbfdf71f8bdaf7fd45a5df5325fd36a1064be2204d9d4c94 \
81123
--hash=sha256:36173ba01a5372c7a1b32352cc73a279a49198f52252adf1c8c1ed41d1f94e8d
@@ -124,8 +166,131 @@ toml==0.10.2 \
124166
tomli==2.0.1 \
125167
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
126168
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
127-
# via black
169+
# via
170+
# black
171+
# mypy
172+
types-boto3==1.0.1 \
173+
--hash=sha256:392d5fdbb40ea0fb20f5116897e96b5e6c5b4a784e8c75aec1f5e12f2ebe3438 \
174+
--hash=sha256:4eb8aad23d4287d2f5b30a36e742f108beab8e0d55eb73817fdce405b8eef95e
175+
# via -r requirements/lint.in
176+
types-certifi==2021.10.8.1 \
177+
--hash=sha256:2290008f32e6ac7c69e779d04fa1bc4c6bb4c7200aa3b3b072ad5475a8968aa5 \
178+
--hash=sha256:546cd3ca4466855959fbc8868fd7139a50eb55a2d1fae497e13b60af439597a3
179+
# via -r requirements/lint.in
180+
types-first==2.0.2 \
181+
--hash=sha256:129155be97b4a65a86a2b4cbc6f2d1de5b40d2c5d370289779fd6dd0293b69f6 \
182+
--hash=sha256:444b4eaba3342f3d360f9f49eb4a175538da212e31ed1f26ee9b54c23f5fa0de
183+
# via -r requirements/lint.in
184+
types-html5lib==1.1.5 \
185+
--hash=sha256:15435ea831ee0fef4cca1382998d51c1e81447ccd38664baab4fb50249695372 \
186+
--hash=sha256:6e190a4e466e3f96f2128fd936a10b1159a57142d01628b0c515f4fc48d2e094
187+
# via -r requirements/lint.in
188+
types-itsdangerous==1.1.6 \
189+
--hash=sha256:21c6966c10e353a5d35d36c82aaa2c5598d3bc32ddc8e0591276da5ad2e3c638 \
190+
--hash=sha256:aef2535c2fa0527dcce244ece0792b20ec02ee46533800735275f82a45a0244d
191+
# via -r requirements/lint.in
192+
types-psycopg2==2.9.7 \
193+
--hash=sha256:90e9393c04ac29af7f000578629020b488f6435abb283d928c1bd8eabb846e14 \
194+
--hash=sha256:cc876db5aa77773deb0abe2e5b088842b91163261294b36caaf7e1087e7e8cd2
195+
# via -r requirements/lint.in
196+
types-python-slugify==5.0.3 \
197+
--hash=sha256:76169f4a6d40896fea76fb45a25c50ac7ba2ca03eee759ecac322a05fe4dd21c \
198+
--hash=sha256:a5761d3c55e949f8ace0694eb5be81210087084bb78df495de14ee5eaad6ac54
199+
# via -r requirements/lint.in
200+
types-pytz==2021.3.5 \
201+
--hash=sha256:8831f689379ac9e2a62668157381379ed74b3702980e08e71f8673c179c4e3c7 \
202+
--hash=sha256:fef8de238ee95135952229a2a23bfb87bd63d5a6c8598106a46cfcf48f069ea8
203+
# via -r requirements/lint.in
204+
types-redis==4.1.17 \
205+
--hash=sha256:5c8707423c60e70ba6ff9a5f01baacbb6c871e44f6a2bd562790cee9edd5b5b1 \
206+
--hash=sha256:7e98c567f0e279b47b0a0ddee8c0180a086e4a5f1b95e6890b40b2a84dc97fb6
207+
# via -r requirements/lint.in
208+
types-requests==2.27.11 \
209+
--hash=sha256:506279bad570c7b4b19ac1f22e50146538befbe0c133b2cea66a9b04a533a859 \
210+
--hash=sha256:6a7ed24b21780af4a5b5e24c310b2cd885fb612df5fd95584d03d87e5f2a195a
211+
# via -r requirements/lint.in
212+
types-setuptools==57.4.9 \
213+
--hash=sha256:536ef74744f8e1e4be4fc719887f886e74e4cf3c792b4a06984320be4df450b5 \
214+
--hash=sha256:948dc6863373750e2cd0b223a84f1fb608414cde5e55cf38ea657b93aeb411d2
215+
# via -r requirements/lint.in
216+
types-urllib3==1.26.10 \
217+
--hash=sha256:a26898f530e6c3f43f25b907f2b884486868ffd56a9faa94cbf9b3eb6e165d6a \
218+
--hash=sha256:d755278d5ecd7a7a6479a190e54230f241f1a99c19b81518b756b19dc69e518c
219+
# via types-requests
128220
typing-extensions==4.1.1 \
129221
--hash=sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42 \
130222
--hash=sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2
131-
# via black
223+
# via
224+
# black
225+
# mypy
226+
zope-event==4.5.0 \
227+
--hash=sha256:2666401939cdaa5f4e0c08cf7f20c9b21423b95e88f4675b1443973bdb080c42 \
228+
--hash=sha256:5e76517f5b9b119acf37ca8819781db6c16ea433f7e2062c4afc2b6fbedb1330
229+
# via zope-schema
230+
zope-interface==5.4.0 \
231+
--hash=sha256:08f9636e99a9d5410181ba0729e0408d3d8748026ea938f3b970a0249daa8192 \
232+
--hash=sha256:0b465ae0962d49c68aa9733ba92a001b2a0933c317780435f00be7ecb959c702 \
233+
--hash=sha256:0cba8477e300d64a11a9789ed40ee8932b59f9ee05f85276dbb4b59acee5dd09 \
234+
--hash=sha256:0cee5187b60ed26d56eb2960136288ce91bcf61e2a9405660d271d1f122a69a4 \
235+
--hash=sha256:0ea1d73b7c9dcbc5080bb8aaffb776f1c68e807767069b9ccdd06f27a161914a \
236+
--hash=sha256:0f91b5b948686659a8e28b728ff5e74b1be6bf40cb04704453617e5f1e945ef3 \
237+
--hash=sha256:15e7d1f7a6ee16572e21e3576d2012b2778cbacf75eb4b7400be37455f5ca8bf \
238+
--hash=sha256:17776ecd3a1fdd2b2cd5373e5ef8b307162f581c693575ec62e7c5399d80794c \
239+
--hash=sha256:194d0bcb1374ac3e1e023961610dc8f2c78a0f5f634d0c737691e215569e640d \
240+
--hash=sha256:1c0e316c9add0db48a5b703833881351444398b04111188069a26a61cfb4df78 \
241+
--hash=sha256:205e40ccde0f37496904572035deea747390a8b7dc65146d30b96e2dd1359a83 \
242+
--hash=sha256:273f158fabc5ea33cbc936da0ab3d4ba80ede5351babc4f577d768e057651531 \
243+
--hash=sha256:2876246527c91e101184f63ccd1d716ec9c46519cc5f3d5375a3351c46467c46 \
244+
--hash=sha256:2c98384b254b37ce50eddd55db8d381a5c53b4c10ee66e1e7fe749824f894021 \
245+
--hash=sha256:2e5a26f16503be6c826abca904e45f1a44ff275fdb7e9d1b75c10671c26f8b94 \
246+
--hash=sha256:334701327f37c47fa628fc8b8d28c7d7730ce7daaf4bda1efb741679c2b087fc \
247+
--hash=sha256:3748fac0d0f6a304e674955ab1365d515993b3a0a865e16a11ec9d86fb307f63 \
248+
--hash=sha256:3c02411a3b62668200910090a0dff17c0b25aaa36145082a5a6adf08fa281e54 \
249+
--hash=sha256:3dd4952748521205697bc2802e4afac5ed4b02909bb799ba1fe239f77fd4e117 \
250+
--hash=sha256:3f24df7124c323fceb53ff6168da70dbfbae1442b4f3da439cd441681f54fe25 \
251+
--hash=sha256:469e2407e0fe9880ac690a3666f03eb4c3c444411a5a5fddfdabc5d184a79f05 \
252+
--hash=sha256:4de4bc9b6d35c5af65b454d3e9bc98c50eb3960d5a3762c9438df57427134b8e \
253+
--hash=sha256:5208ebd5152e040640518a77827bdfcc73773a15a33d6644015b763b9c9febc1 \
254+
--hash=sha256:52de7fc6c21b419078008f697fd4103dbc763288b1406b4562554bd47514c004 \
255+
--hash=sha256:5bb3489b4558e49ad2c5118137cfeaf59434f9737fa9c5deefc72d22c23822e2 \
256+
--hash=sha256:5dba5f530fec3f0988d83b78cc591b58c0b6eb8431a85edd1569a0539a8a5a0e \
257+
--hash=sha256:5dd9ca406499444f4c8299f803d4a14edf7890ecc595c8b1c7115c2342cadc5f \
258+
--hash=sha256:5f931a1c21dfa7a9c573ec1f50a31135ccce84e32507c54e1ea404894c5eb96f \
259+
--hash=sha256:63b82bb63de7c821428d513607e84c6d97d58afd1fe2eb645030bdc185440120 \
260+
--hash=sha256:66c0061c91b3b9cf542131148ef7ecbecb2690d48d1612ec386de9d36766058f \
261+
--hash=sha256:6f0c02cbb9691b7c91d5009108f975f8ffeab5dff8f26d62e21c493060eff2a1 \
262+
--hash=sha256:71aace0c42d53abe6fc7f726c5d3b60d90f3c5c055a447950ad6ea9cec2e37d9 \
263+
--hash=sha256:7d97a4306898b05404a0dcdc32d9709b7d8832c0c542b861d9a826301719794e \
264+
--hash=sha256:7df1e1c05304f26faa49fa752a8c690126cf98b40b91d54e6e9cc3b7d6ffe8b7 \
265+
--hash=sha256:8270252effc60b9642b423189a2fe90eb6b59e87cbee54549db3f5562ff8d1b8 \
266+
--hash=sha256:867a5ad16892bf20e6c4ea2aab1971f45645ff3102ad29bd84c86027fa99997b \
267+
--hash=sha256:877473e675fdcc113c138813a5dd440da0769a2d81f4d86614e5d62b69497155 \
268+
--hash=sha256:8892f89999ffd992208754851e5a052f6b5db70a1e3f7d54b17c5211e37a98c7 \
269+
--hash=sha256:9a9845c4c6bb56e508651f005c4aeb0404e518c6f000d5a1123ab077ab769f5c \
270+
--hash=sha256:a1e6e96217a0f72e2b8629e271e1b280c6fa3fe6e59fa8f6701bec14e3354325 \
271+
--hash=sha256:a8156e6a7f5e2a0ff0c5b21d6bcb45145efece1909efcbbbf48c56f8da68221d \
272+
--hash=sha256:a9506a7e80bcf6eacfff7f804c0ad5350c8c95b9010e4356a4b36f5322f09abb \
273+
--hash=sha256:af310ec8335016b5e52cae60cda4a4f2a60a788cbb949a4fbea13d441aa5a09e \
274+
--hash=sha256:b0297b1e05fd128d26cc2460c810d42e205d16d76799526dfa8c8ccd50e74959 \
275+
--hash=sha256:bf68f4b2b6683e52bec69273562df15af352e5ed25d1b6641e7efddc5951d1a7 \
276+
--hash=sha256:d0c1bc2fa9a7285719e5678584f6b92572a5b639d0e471bb8d4b650a1a910920 \
277+
--hash=sha256:d4d9d6c1a455d4babd320203b918ccc7fcbefe308615c521062bc2ba1aa4d26e \
278+
--hash=sha256:db1fa631737dab9fa0b37f3979d8d2631e348c3b4e8325d6873c2541d0ae5a48 \
279+
--hash=sha256:dd93ea5c0c7f3e25335ab7d22a507b1dc43976e1345508f845efc573d3d779d8 \
280+
--hash=sha256:f44e517131a98f7a76696a7b21b164bcb85291cee106a23beccce454e1f433a4 \
281+
--hash=sha256:f7ee479e96f7ee350db1cf24afa5685a5899e2b34992fb99e1f7c1b0b758d263
282+
# via
283+
# mypy-zope
284+
# zope-schema
285+
zope-schema==6.2.0 \
286+
--hash=sha256:03150d8670549590b45109e06b7b964f4e751fa9cb5297ec4985c3bc38641b07 \
287+
--hash=sha256:2201aef8ad75ee5a881284d7a6acd384661d6dca7bde5e80a22839a77124595b
288+
# via mypy-zope
289+
290+
# The following packages are considered to be unsafe in a requirements file:
291+
setuptools==60.9.3 \
292+
--hash=sha256:2347b2b432c891a863acadca2da9ac101eae6169b1d3dfee2ec605ecd50dbfe5 \
293+
--hash=sha256:e4f30b9f84e5ab3decf945113119649fec09c1fc3507c6ebffec75646c56e62b
294+
# via
295+
# zope-interface
296+
# zope-schema

warehouse/accounts/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def email(self):
135135
primary_email = self.primary_email
136136
return primary_email.email if primary_email else None
137137

138-
@email.expression
138+
@email.expression # type: ignore
139139
def email(self):
140140
return (
141141
select([Email.email])

warehouse/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ def warehouse(ctx):
4343

4444
# We want to automatically import all of the warehouse.cli.* modules so that
4545
# any commands registered in any of them will be discovered.
46-
for _, name, _ in pkgutil.walk_packages(__path__, prefix=__name__ + "."):
46+
for _, name, _ in pkgutil.walk_packages(__path__, prefix=__name__ + "."): # type: ignore # noqa
4747
importlib.import_module(name)

warehouse/csrf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def wrapped(context, request):
4040
return wrapped
4141

4242

43-
require_method_view.options = {"require_methods"}
43+
require_method_view.options = {"require_methods"} # type: ignore
4444

4545

4646
def includeme(config):

warehouse/db.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from sqlalchemy import event, inspect
2525
from sqlalchemy.dialects.postgresql import UUID
2626
from sqlalchemy.exc import IntegrityError, OperationalError
27-
from sqlalchemy.ext.declarative import declarative_base
27+
from sqlalchemy.ext.declarative import declarative_base # type: ignore
2828
from sqlalchemy.orm import sessionmaker
2929

3030
from warehouse.metrics import IMetricsService
@@ -97,7 +97,7 @@ def __repr__(self):
9797

9898

9999
# Base class for models using declarative syntax
100-
ModelBase = declarative_base(cls=ModelBase, metadata=metadata)
100+
ModelBase = declarative_base(cls=ModelBase, metadata=metadata) # type: ignore
101101

102102

103103
class Model(ModelBase):

warehouse/email/ses/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class EmailMessage(db.Model):
251251
backref="email",
252252
cascade="all, delete-orphan",
253253
lazy=False,
254-
order_by=lambda: Event.created,
254+
order_by=lambda: Event.created, # type: ignore
255255
)
256256

257257

warehouse/i18n/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def wrapped(context, request):
170170
return wrapped
171171

172172

173-
translated_view.options = {"has_translations"}
173+
translated_view.options = {"has_translations"} # type: ignore
174174

175175

176176
def includeme(config):

warehouse/legacy/api/xmlrpc/cache/derivers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def wrapper_view(context, request):
4343
return view
4444

4545

46-
cached_return_view.options = [
46+
cached_return_view.options = [ # type: ignore
4747
"xmlrpc_cache",
4848
"xmlrpc_cache_tag",
4949
"xmlrpc_cache_expires",

warehouse/legacy/api/xmlrpc/cache/interfaces.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def create_service(context, request):
2424
created for.
2525
"""
2626

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

36-
def purge(self, tag):
36+
def purge(tag):
3737
"""
3838
Issues a purge, clearing all cached objects associated with the tag
3939
from the cache.
4040
"""
4141

42-
def purge_tags(self, tags):
42+
def purge_tags(tags):
4343
"""
4444
Issues a purge, clearing all cached objects associated with each tag
4545
in the iterable tags.

0 commit comments

Comments
 (0)