Skip to content

Commit

Permalink
fix ruff preview errors, use str.removesuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Sep 14, 2024
1 parent 4c78aa4 commit 03a509b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
6 changes: 2 additions & 4 deletions pyglossary/entry_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,9 @@ def cleanDefi(self, st: str) -> str:
st = self.spacesNewlinePattern.sub("\n", st)

st = self.blocksNewlinePattern.sub("♦", st)
if st.endswith("<p"):
st = st[:-2]
st = st.removesuffix("<p")
st = st.strip()
if st.endswith(","):
st = st[:-1]
st = st.removesuffix(",")

return st # noqa: RET504

Expand Down
3 changes: 1 addition & 2 deletions pyglossary/plugins/dict_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ def __init__(self, glos: GlossaryType) -> None:
)

def open(self, filename: str) -> None:
if filename.endswith(".index"):
filename = filename[:-6]
filename = filename.removesuffix(".index")
self._filename = filename
self._dictdb = DictDB(filename, "read", 1)

Expand Down
1 change: 0 additions & 1 deletion pyglossary/plugins/stardict_textual.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,4 +399,3 @@ def write(self) -> "Generator[None, EntryType, None]":

if not os.listdir(self._resDir):
os.rmdir(self._resDir)

0 comments on commit 03a509b

Please sign in to comment.