Skip to content

Commit c9fcfaf

Browse files
authored
Move B105/B107 from global skips to location-specific nosec comments
1 parent 23b6535 commit c9fcfaf

5 files changed

Lines changed: 10 additions & 12 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,9 @@ ignore_missing_imports = true
500500

501501
[tool.bandit]
502502
# Skip tests that produce known false positives or are accepted risks.
503-
# B105, B107: String/default value detected as hardcoded password.
504-
# False positives: tokenizer special tokens and numeric config values.
505503
# B110: Try/Except/Pass. Accepted pattern in optional-dependency loading.
506-
# B202, B310, B311, B614: suppressed at each call site with # nosec comments.
507-
skips = ["B105", "B107", "B110"]
504+
# B105, B107, B202, B310, B311, B614: suppressed at each call site with # nosec comments.
505+
skips = ["B110"]
508506

509507
[tool.pylint.main]
510508
disable = [

pythainlp/generate/thai2fit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"emb_sz": 400,
9898
"n_hid": 1550,
9999
"n_layers": 4,
100-
"pad_token": 1,
100+
"pad_token": 1, # nosec B105
101101
"qrnn": False,
102102
"tie_weights": True,
103103
"out_bias": True,

pythainlp/phayathaibert/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def rm_useless_spaces(self, text: str) -> str:
120120
"""
121121
return re.sub(" {2,}", " ", text)
122122

123-
def replace_spaces(self, text: str, space_token: str = "<_>") -> str: # noqa: S107
123+
def replace_spaces(self, text: str, space_token: str = "<_>") -> str: # noqa: S107 # nosec B107
124124
"""Replace spaces with _
125125
:param str text: text to replace spaces
126126
:return: text where all spaces replaced with _

pythainlp/tokenize/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def rejoin_formatted_num(segments: list[str]) -> list[str]:
5656
is_span_beginning = pos >= match.start()
5757
token = segments[segment_idx]
5858
if is_span_beginning:
59-
connected_token = ""
59+
connected_token = "" # nosec B105
6060
while pos < match.end() and segment_idx < len(segments):
6161
connected_token += segments[segment_idx]
6262
pos += len(segments[segment_idx])

pythainlp/translate/tokenization_small100.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ def __init__(
149149
vocab_file: str,
150150
spm_file: str,
151151
tgt_lang: Optional[str] = None,
152-
bos_token: str = "<s>", # noqa: S107
153-
eos_token: str = "</s>", # noqa: S107
154-
sep_token: str = "</s>", # noqa: S107
155-
pad_token: str = "<pad>", # noqa: S107
156-
unk_token: str = "<unk>", # noqa: S107
152+
bos_token: str = "<s>", # noqa: S107 # nosec B107
153+
eos_token: str = "</s>", # noqa: S107 # nosec B107
154+
sep_token: str = "</s>", # noqa: S107 # nosec B107
155+
pad_token: str = "<pad>", # noqa: S107 # nosec B107
156+
unk_token: str = "<unk>", # noqa: S107 # nosec B107
157157
language_codes: str = "m2m100",
158158
sp_model_kwargs: Optional[dict[str, str]] = None,
159159
num_madeup_words: int = 8,

0 commit comments

Comments
 (0)