codespell_ignore_lines_from_errors.py
Go to the documentation of this file.
1 """Simple script for rebuilding .codespell-ignore-lines
2 
3 Usage:
4 
5 cat < /dev/null > .codespell-ignore-lines
6 pre-commit run --all-files codespell >& /tmp/codespell_errors.txt
7 python3 tools/codespell_ignore_lines_from_errors.py /tmp/codespell_errors.txt > .codespell-ignore-lines
8 
9 git diff to review changes, then commit, push.
10 """
11 
12 from __future__ import annotations
13 
14 import sys
15 
16 
17 def run(args: list[str]) -> None:
18  assert len(args) == 1, "codespell_errors.txt"
19  cache = {}
20  done = set()
21  with open(args[0]) as f:
22  lines = f.read().splitlines()
23 
24  for line in sorted(lines):
25  i = line.find(" ==> ")
26  if i > 0:
27  flds = line[:i].split(":")
28  if len(flds) >= 2:
29  filename, line_num = flds[:2]
30  if filename not in cache:
31  with open(filename) as f:
32  cache[filename] = f.read().splitlines()
33  supp = cache[filename][int(line_num) - 1]
34  if supp not in done:
35  print(supp)
36  done.add(supp)
37 
38 
39 if __name__ == "__main__":
40  run(args=sys.argv[1:])
gtsam.examples.DogLegOptimizerExample.int
int
Definition: DogLegOptimizerExample.py:111
Eigen::internal::print
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Definition: NEON/PacketMath.h:3115
set
Definition: pytypes.h:2232
codespell_ignore_lines_from_errors.run
None run(list[str] args)
Definition: codespell_ignore_lines_from_errors.py:17
gtsam::split
void split(const G &g, const PredecessorMap< KEY > &tree, G &Ab1, G &Ab2)
Definition: graph-inl.h:245
len
size_t len(handle h)
Get the length of a Python object.
Definition: pytypes.h:2446


gtsam
Author(s):
autogenerated on Sat Sep 28 2024 03:00:27