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 import sys
13 from typing import List
14 
15 
16 def run(args: List[str]) -> None:
17  assert len(args) == 1, "codespell_errors.txt"
18  cache = {}
19  done = set()
20  with open(args[0]) as f:
21  lines = f.read().splitlines()
22 
23  for line in sorted(lines):
24  i = line.find(" ==> ")
25  if i > 0:
26  flds = line[:i].split(":")
27  if len(flds) >= 2:
28  filename, line_num = flds[:2]
29  if filename not in cache:
30  with open(filename) as f:
31  cache[filename] = f.read().splitlines()
32  supp = cache[filename][int(line_num) - 1]
33  if supp not in done:
34  print(supp)
35  done.add(supp)
36 
37 
38 if __name__ == "__main__":
39  run(args=sys.argv[1:])
gtsam.examples.DogLegOptimizerExample.int
int
Definition: DogLegOptimizerExample.py:111
codespell_ignore_lines_from_errors.run
None run(List[str] args)
Definition: codespell_ignore_lines_from_errors.py:16
Eigen::internal::print
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Definition: NEON/PacketMath.h:3115
set
Definition: pytypes.h:2185
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:2399


gtsam
Author(s):
autogenerated on Mon Jul 1 2024 03:00:56