Skip to content

Commit bce699c

Browse files
authored
Merge branch 'master' into src-none
2 parents 2aab28c + c55a243 commit bce699c

File tree

4 files changed

+30
-25
lines changed

4 files changed

+30
-25
lines changed

.pre-commit-config.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,40 @@ exclude: >
1616
repos:
1717

1818
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v3.3.0
19+
rev: v3.4.0
2020
hooks:
2121
- id: check-json
2222
- id: check-yaml
2323
- id: end-of-file-fixer
2424
- id: trailing-whitespace
2525

2626
- repo: https://github.com/mgedmin/check-manifest
27-
rev: "0.44"
27+
rev: "0.46"
2828
hooks:
2929
- id: check-manifest
30+
args: [--no-build-isolation]
31+
additional_dependencies: [setuptools>=46.4.0]
32+
33+
# this is not used for now,
34+
# since it converts markdown-it-py to markdown_it_py and removes comments
35+
# - repo: https://github.com/asottile/setup-cfg-fmt
36+
# rev: v1.17.0
37+
# hooks:
38+
# - id: setup-cfg-fmt
3039

3140
- repo: https://github.com/psf/black
3241
rev: 20.8b1
3342
hooks:
3443
- id: black
3544

3645
- repo: https://gitlab.com/pycqa/flake8
37-
rev: 3.8.4
46+
rev: 3.9.1
3847
hooks:
3948
- id: flake8
4049
additional_dependencies: [flake8-bugbear==21.3.1]
4150

4251
- repo: https://github.com/pre-commit/mirrors-mypy
43-
rev: v0.790
52+
rev: v0.812
4453
hooks:
4554
- id: mypy
4655
additional_dependencies: [attrs]
47-
48-
- repo: https://github.com/asottile/setup-cfg-fmt
49-
rev: v1.16.0
50-
hooks:
51-
- id: setup-cfg-fmt

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
("py:class", "markdown_it.helpers.parse_link_destination._Result"),
5252
("py:class", "markdown_it.helpers.parse_link_title._Result"),
5353
("py:class", "MarkdownIt"),
54+
("py:class", "_NodeType"),
5455
]
5556

5657

markdown_it/common/utils.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
"""
33
import html
44
import re
5+
from typing import Any
56

67
from .entities import entities
78

89
# from .normalize_url import unescape_string
910

1011

11-
def charCodeAt(src: str, pos: int):
12+
def charCodeAt(src: str, pos: int) -> Any:
1213
"""
1314
Returns the Unicode value of the character at the specified location.
1415
@@ -26,12 +27,11 @@ def charCodeAt(src: str, pos: int):
2627
# function _class(obj) { return Object.prototype.toString.call(obj); }
2728

2829

29-
def isString(obj):
30+
def isString(obj: object) -> bool:
3031
return isinstance(obj, str)
3132

3233

33-
def has(object, key):
34-
return hasattr(object, key)
34+
has = hasattr
3535

3636

3737
# Merge objects
@@ -56,18 +56,18 @@ def assign(obj):
5656
# return obj
5757

5858

59-
def arrayReplaceAt(src: list, pos: int, newElements: list):
59+
def arrayReplaceAt(src: list, pos: int, newElements: list) -> list:
6060
"""
6161
Remove element from array and put another array at those position.
6262
Useful for some operations with tokens
6363
"""
64-
return src[0:pos] + newElements + src[pos + 1 :]
64+
return src[:pos] + newElements + src[pos + 1 :]
6565

6666

6767
######################################################################
6868

6969

70-
def isValidEntityCode(c):
70+
def isValidEntityCode(c: int) -> bool:
7171

7272
# broken sequence
7373
if c >= 0xD800 and c <= 0xDFFF:
@@ -111,7 +111,7 @@ def fromCodePoint(c: int) -> str:
111111
DIGITAL_ENTITY_TEST_RE = re.compile(r"^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))", re.IGNORECASE)
112112

113113

114-
def replaceEntityPattern(match, name):
114+
def replaceEntityPattern(match: str, name: str) -> str:
115115
"""Convert HTML entity patterns
116116
117117
::
@@ -138,22 +138,22 @@ def replaceEntityPattern(match, name):
138138
# return string.replace(ENTITY_RE, replaceEntityPattern)
139139

140140

141-
def unescapeMd(string: str):
141+
def unescapeMd(string: str) -> str:
142142
raise NotImplementedError
143143
# if "\\" in string:
144144
# return string
145145
# return string.replace(UNESCAPE_MD_RE, "$1")
146146

147147

148-
def unescapeAll(string: str):
148+
def unescapeAll(string: str) -> str:
149149
return html.unescape(string)
150150

151151

152152
ESCAPABLE = r"""\\!"#$%&'()*+,./:;<=>?@\[\]^`{}|_~-"""
153153
ESCAPE_CHAR = re.compile(r"\\([" + ESCAPABLE + r"])")
154154

155155

156-
def stripEscape(string):
156+
def stripEscape(string: str) -> str:
157157
"""Strip escape \\ characters"""
158158
return ESCAPE_CHAR.sub(r"\1", string)
159159

@@ -179,7 +179,7 @@ def stripEscape(string):
179179
# return string
180180

181181

182-
def escapeHtml(raw: str):
182+
def escapeHtml(raw: str) -> str:
183183
# return html.escape(html.unescape(raw)).replace("&#x27;", "'")
184184
return html.escape(raw).replace("&#x27;", "'")
185185

@@ -197,7 +197,7 @@ def escapeRE(string: str) -> str:
197197
# //////////////////////////////////////////////////////////////////////////////
198198

199199

200-
def isSpace(code) -> bool:
200+
def isSpace(code: object) -> bool:
201201
return code in {0x09, 0x20}
202202

203203

@@ -271,7 +271,7 @@ def isPunctChar(ch: str) -> bool:
271271
}
272272

273273

274-
def isMdAsciiPunct(ch: int):
274+
def isMdAsciiPunct(ch: int) -> bool:
275275
"""Markdown ASCII punctuation characters.
276276
277277
::

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[metadata]
2-
name = markdown_it_py
2+
name = markdown-it-py
33
version = attr: markdown_it.__version__
44
description = Python port of markdown-it. Markdown parsing, done right!
55
long_description = file: README.md
@@ -52,7 +52,7 @@ linkify =
5252
plugins =
5353
mdit-py-plugins
5454
rtd =
55-
myst-nb~=0.11.1
55+
myst-nb==0.13.0a1
5656
pyyaml
5757
sphinx>=2,<4
5858
sphinx-copybutton

0 commit comments

Comments
 (0)