Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0c933dc

Browse files
authored
🔧 Use str.removesuffix (#348)
1 parent c5161b5 commit 0c933dc

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

‎markdown_it/tree.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def type(self) -> str:
162162
if self.token:
163163
return self.token.type
164164
assert self.nester_tokens
165-
return _removesuffix(self.nester_tokens.opening.type, "_open")
165+
return self.nester_tokens.opening.type.removesuffix("_open")
166166

167167
@property
168168
def next_sibling(self: _NodeType) -> _NodeType | None:
@@ -331,14 +331,3 @@ def hidden(self) -> bool:
331331
"""If it's true, ignore this element when rendering.
332332
Used for tight lists to hide paragraphs."""
333333
return self._attribute_token().hidden
334-
335-
336-
def _removesuffix(string: str, suffix: str) -> str:
337-
"""Remove a suffix from a string.
338-
339-
Replace this with str.removesuffix() from stdlib when minimum Python
340-
version is 3.9.
341-
"""
342-
if suffix and string.endswith(suffix):
343-
return string[: -len(suffix)]
344-
return string

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /