Skip to content

Commit a32f711

Browse files
cdce8pericmarkmartin
authored andcommitted
Add codespell to pre-commit config (python#18645)
Replaces python#18387 Use codespell in pre-commit to detect spelling mistakes, see python#18642. Ignore test and typeshed folders.
1 parent 9153523 commit a32f711

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

.pre-commit-config.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ repos:
2121
- id: check-github-workflows
2222
- id: check-github-actions
2323
- id: check-readthedocs
24+
- repo: https://github.com/codespell-project/codespell
25+
rev: v2.4.1
26+
hooks:
27+
- id: codespell
28+
args:
29+
- --ignore-words-list=HAX,ccompiler,ot,statics,whet,zar
30+
exclude: ^(mypy/test/|mypy/typeshed/|mypyc/test-data/|test-data/).+$
2431
- repo: https://github.com/rhysd/actionlint
2532
rev: v1.7.7
2633
hooks:

mypy/fastparse.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def from_operator(self, op: ast3.operator) -> str:
557557
ast3.Is: "is",
558558
ast3.IsNot: "is not",
559559
ast3.In: "in",
560-
ast3.NotIn: "not in",
560+
ast3.NotIn: "not in", # codespell:ignore notin
561561
}
562562

563563
def from_comp_operator(self, op: ast3.cmpop) -> str:
@@ -2169,7 +2169,7 @@ def visit_member_expr(self, e: MemberExpr) -> None:
21692169

21702170

21712171
class FindYield(TraverserVisitor):
2172-
"""Check if an AST contains yields or yield froms."""
2172+
"""Check if an AST contains yields or yield froms.""" # codespell:ignore froms
21732173

21742174
def __init__(self) -> None:
21752175
self.found = False

mypy/nodes.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ class Node(Context):
176176
__slots__ = ()
177177

178178
def __str__(self) -> str:
179-
ans = self.accept(mypy.strconv.StrConv(options=Options()))
180-
if ans is None:
179+
a = self.accept(mypy.strconv.StrConv(options=Options()))
180+
if a is None:
181181
return repr(self)
182-
return ans
182+
return a
183183

184184
def str_with_options(self, options: Options) -> str:
185-
ans = self.accept(mypy.strconv.StrConv(options=options))
186-
assert ans
187-
return ans
185+
a = self.accept(mypy.strconv.StrConv(options=options))
186+
assert a
187+
return a
188188

189189
def accept(self, visitor: NodeVisitor[T]) -> T:
190190
raise RuntimeError("Not implemented", type(self))

mypy/stubinfo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def stub_distribution_name(module: str) -> str | None:
9797
"commctrl": "types-pywin32",
9898
"commonmark": "types-commonmark",
9999
"consolemenu": "types-console-menu",
100-
"corus": "types-corus",
100+
"corus": "types-corus", # codespell:ignore corus
101101
"cronlog": "types-python-crontab",
102102
"crontab": "types-python-crontab",
103103
"crontabs": "types-python-crontab",

0 commit comments

Comments
 (0)