File: sort-pylint-spelling-words.py

package info (click to toggle)
python-pytest-shell-utilities 1.9.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 580 kB
  • sloc: python: 2,998; makefile: 18
file content (21 lines) | stat: -rwxr-xr-x 579 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python
# Copyright 2021-2024 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
# 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()