File: sort-pylint-spelling-words.py

package info (click to toggle)
pytest-helpers-namespace 2021.4.29-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 296 kB
  • sloc: python: 554; makefile: 163
file content (19 lines) | stat: -rwxr-xr-x 506 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
# pylint: skip-file
import pathlib

REPO_ROOT = pathlib.Path(__name__).resolve().parent
PYLINT_SPELLING_WORDS = REPO_ROOT / ".pylint-spelling-words"


def sort():
    in_contents = PYLINT_SPELLING_WORDS.read_text()
    out_contents = ""
    out_contents += "\n".join(sorted([line.lower() for line in in_contents.splitlines()]))
    out_contents += "\n"
    if in_contents != out_contents:
        PYLINT_SPELLING_WORDS.write_text(out_contents)


if __name__ == "__main__":
    sort()