Skip to content

Commit 65a7788

Browse files
authored
Merge pull request #1207 from PyThaiNLP/copilot/remove-star-imports
Remove star imports and enable F403/F405 Ruff checks
2 parents 7842ad9 + ca80e67 commit 65a7788

4 files changed

Lines changed: 23 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,5 @@ select = [
317317
"W293",
318318
]
319319
# Some rules are ignored for now; we can consider enabling them in the future.
320-
# F403 and F405 are ignored due to thai2fit/ulmfit module's star imports.
321320
# S101 is use of assert statement, should be an easy fix.
322-
extend-ignore = ["E402", "E501", "E722", "F403", "F405", "S101", "S202", "S301", "S310"]
321+
extend-ignore = ["E402", "E501", "E722", "S101", "S202", "S301", "S310"]

pythainlp/generate/thai2fit.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@
1717
# fastai
1818
import fastai
1919
import pandas as pd
20-
from fastai.text import *
20+
from fastai.text import (
21+
AWD_LSTM,
22+
NumericalizeProcessor,
23+
TextList,
24+
TokenizeProcessor,
25+
Tokenizer,
26+
URLs,
27+
language_model_learner,
28+
untar_data,
29+
)
2130

2231
# pythainlp
2332
from pythainlp.ulmfit import (

pythainlp/ulmfit/core.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,8 @@ def document_vector(text: str, learn, data, agg: str = "mean"):
162162
163163
:Example:
164164
165-
>>> from pythainlp.ulmfit import document_vectorr
166-
>>> from fastai import *
167-
>>> from fastai.text import *
165+
>>> from pythainlp.ulmfit import document_vector
166+
>>> from fastai.text import load_data, language_model_learner, AWD_LSTM
168167
>>>
169168
>>> # Load Data Bunch
170169
>>> data = load_data(MODEL_PATH, 'thwiki_lm_data.pkl')

tests/extra/testx_ulmfit.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88
import fastai
99
import pandas as pd
1010
import torch
11-
from fastai.text import *
11+
from fastai.text import (
12+
AWD_LSTM,
13+
NumericalizeProcessor,
14+
TextList,
15+
TokenizeProcessor,
16+
Tokenizer,
17+
URLs,
18+
language_model_learner,
19+
untar_data,
20+
)
1221

1322
from pythainlp.tokenize import THAI2FIT_TOKENIZER
1423
from pythainlp.ulmfit import (

0 commit comments

Comments
 (0)