Add mypy types for libraries that have them now

main
Danielle McLean 9 months ago
parent 8d79be07da
commit 0ca50252dd
Signed by: 00dani
GPG Key ID: 9DDE1EDE01E3A605
  1. 5
      Pipfile
  2. 49
      Pipfile.lock
  3. 8
      lemoncurry/jinja2/bleach.py
  4. 8
      lemoncurry/templatetags/bleach.py

@ -56,3 +56,8 @@ pytest-django = "*"
werkzeug = "*"
watchdog = "*"
mypy = "*"
types-pyyaml = "*"
types-requests = "*"
types-python-slugify = "*"
types-bleach = "*"
types-markdown = "*"

49
Pipfile.lock generated

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "1c5a457377ca29205680f06286e9ef47d6ff08d1de75b2e7371ca3993bf75a1c"
"sha256": "ee4526802dcda54a4e26bfbbb785418a1ac2cdaf04b9ed556a0fcd61072356f9"
},
"pipfile-spec": 6,
"requires": {
@ -1411,6 +1411,53 @@
"markers": "python_version < '3.8'",
"version": "==1.5.2"
},
"types-bleach": {
"hashes": [
"sha256:2d30c2c4fb6854088ac636471352c9a51bf6c089289800d2a8060820a01cd43a",
"sha256:edffe173ed6d7b6f3543036a96204a9319c3bf6c3645917b14274e43f000cc9b"
],
"index": "pypi",
"version": "==4.1.4"
},
"types-markdown": {
"hashes": [
"sha256:9a1428bfe856a0df0ac1e74507ee0cfe841c8b2a676cb83672ca249cb9f54a00",
"sha256:bcc56dfb95be2389646e01808dc637c45805a9bb38047c93a509d96d183ca79d"
],
"index": "pypi",
"version": "==3.3.12"
},
"types-python-slugify": {
"hashes": [
"sha256:76169f4a6d40896fea76fb45a25c50ac7ba2ca03eee759ecac322a05fe4dd21c",
"sha256:a5761d3c55e949f8ace0694eb5be81210087084bb78df495de14ee5eaad6ac54"
],
"index": "pypi",
"version": "==5.0.3"
},
"types-pyyaml": {
"hashes": [
"sha256:6252f62d785e730e454dfa0c9f0fb99d8dae254c5c3c686903cf878ea27c04b7",
"sha256:693b01c713464a6851f36ff41077f8adbc6e355eda929addfb4a97208aea9b4b"
],
"index": "pypi",
"version": "==6.0.4"
},
"types-requests": {
"hashes": [
"sha256:5dcb088fcaa778efeee6b7fc46967037e983fbfb9fec02594578bd33fd75e555",
"sha256:6cb4fb0bbcbc585c57eeee6ffe5a47638dc89706b8d290ec89a77213fc5bad1a"
],
"index": "pypi",
"version": "==2.27.10"
},
"types-urllib3": {
"hashes": [
"sha256:4a54f6274ab1c80968115634a55fb9341a699492b95e32104a7c513db9fe02e9",
"sha256:abd2d4857837482b1834b4817f0587678dcc531dbc9abe4cde4da28cef3f522c"
],
"version": "==1.26.9"
},
"typing-extensions": {
"hashes": [
"sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42",

@ -5,10 +5,10 @@ from jinja2 import evalcontextfilter, Markup
TAGS = ['cite', 'code', 'details', 'p', 'pre', 'img', 'span', 'summary']
TAGS.extend(ALLOWED_TAGS)
ATTRIBUTES = {
'a': ('href', 'title', 'class'),
'details': ('open',),
'img': ('alt', 'src', 'title'),
'span': ('class',),
'a': ['href', 'title', 'class'],
'details': ['open'],
'img': ['alt', 'src', 'title'],
'span': ['class'],
}
cleaner = Cleaner(tags=TAGS, attributes=ATTRIBUTES, filters=(LinkifyFilter,))

@ -8,10 +8,10 @@ from bleach.linkifier import LinkifyFilter
tags = ['cite', 'code', 'details', 'p', 'pre', 'img', 'span', 'summary']
tags.extend(ALLOWED_TAGS)
attributes = {
'a': ('href', 'title', 'class'),
'details': ('open',),
'img': ('alt', 'src', 'title'),
'span': ('class',),
'a': ['href', 'title', 'class'],
'details': ['open'],
'img': ['alt', 'src', 'title'],
'span': ['class'],
}
register = template.Library()

Loading…
Cancel
Save