Skip to content

Commit a7efd01

Browse files
authored
Merge pull request #1191 from bact/dev
Add whitespace check
2 parents 0beadd8 + d704a50 commit a7efd01

196 files changed

Lines changed: 650 additions & 1151 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
uses: astral-sh/ruff-action@v3
2727
with:
2828
src: "./pythainlp"
29-
args: check --verbose --line-length 79 --select C901
29+
args: check --fix --verbose --line-length 79 --select I,W,C901,W291,W293

docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import os
1010
import sys
1111
import traceback
12-
from datetime import datetime
13-
from datetime import date
12+
from datetime import date, datetime
13+
1414
import pythainlp
1515

1616
# -- Path setup --------------------------------------------------------------
@@ -34,7 +34,7 @@
3434
# -- Get version information and date from Git ----------------------------
3535

3636
try:
37-
from subprocess import check_output, STDOUT
37+
from subprocess import STDOUT, check_output
3838

3939
current_branch = (
4040
os.environ["CURRENT_BRANCH"]
@@ -69,7 +69,7 @@
6969
# .decode()
7070
# .strip()
7171
# )
72-
except Exception as e:
72+
except Exception:
7373
traceback.print_exc()
7474
release = pythainlp.__version__
7575
# today = "<unknown date>"

examples/khavee.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project
33
# SPDX-FileType: SOURCE
44
# SPDX-License-Identifier: Apache-2.0
5-
"""
6-
Example of using KhaveeVerifier from pythainlp.khavee
5+
"""Example of using KhaveeVerifier from pythainlp.khavee
76
"""
87

98
from pythainlp.khavee import KhaveeVerifier
109

11-
1210
kv = KhaveeVerifier()
1311

1412
# การเช็คสระ
@@ -64,7 +62,7 @@
6462
เรื่องวิศวะเก่งกาจประหลาดใจ เรื่องฟิสิกส์ไร้ผู้ใดมาต่อไป
6563
นริศราอีฟเก่งกว่าใครเพื่อน คอยช่วยเตือนเรื่องงานคอยสั่งสอน
6664
อ่านตำราหาความรู้ไม่ละทอน เป็นคนดีศรีนครของจิตรลดา
67-
ภัสนันท์นาคลออหรือมีมี่ เรื่องเกมเอ่อเก่งกาจไม่กังขา
65+
ภัสนันท์นาคลออหรือมีมี่ เรื่องเกมเอ่อเก่งกาจไม่กังขา
6866
เกมอะไรก็เล่นได้ไม่ลดวา สุดฉลาดมากปัญญามาครบครัน""",
6967
k_type=8,
7068
)

notebooks/convert_thai2rom_to_onnx.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"outputs": [],
7676
"source": [
7777
"import torch\n",
78+
"\n",
7879
"from pythainlp.corpus import get_corpus_path\n",
7980
"from pythainlp.transliterate.thai2rom import _MODEL_NAME\n",
8081
"\n",
@@ -115,7 +116,6 @@
115116
"outputs": [],
116117
"source": [
117118
"import torch\n",
118-
"import numpy as np\n",
119119
"\n",
120120
"input_tensor = torch.Tensor([[30, 19, 8, 30, 38, 37, 10, 3]]).long()\n",
121121
"\n",

notebooks/create_words.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9-
"from pythainlp.transliterate import pronunciate\n",
10-
"from pythainlp import thai_consonants"
9+
"from pythainlp import thai_consonants\n",
10+
"from pythainlp.transliterate import pronunciate"
1111
]
1212
},
1313
{

notebooks/test_chat.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
},
1010
"outputs": [],
1111
"source": [
12-
"from pythainlp.chat.core import ChatBotModel\n",
13-
"import torch"
12+
"import torch\n",
13+
"\n",
14+
"from pythainlp.chat.core import ChatBotModel"
1415
]
1516
},
1617
{

notebooks/test_el.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"outputs": [],
99
"source": [
1010
"import os\n",
11+
"\n",
1112
"os.environ[\"CUDA_VISIBLE_DEVICES\"]=\"1\""
1213
]
1314
},

notebooks/test_wangchanglm.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
},
1010
"outputs": [],
1111
"source": [
12-
"from pythainlp.generate.wangchanglm import WangChanGLM\n",
13-
"import torch"
12+
"import torch\n",
13+
"\n",
14+
"from pythainlp.generate.wangchanglm import WangChanGLM"
1415
]
1516
},
1617
{

notebooks/test_wsd.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
},
8181
"outputs": [],
8282
"source": [
83-
"from pythainlp.corpus import get_corpus_path, thai_wsd_dict"
83+
"from pythainlp.corpus import thai_wsd_dict"
8484
]
8585
},
8686
{

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,4 @@ docstring-code-format = true
301301
[tool.ruff.lint.mccabe]
302302
# Flag errors (`C901`) whenever the complexity level exceeds 5. Default is 10.
303303
# We should aim to gradually reduce this to 10.
304-
max-complexity = 40
304+
max-complexity = 38

0 commit comments

Comments
 (0)