import subprocess for fn in subprocess.run(["hg","files",".","-0"], stdout=subprocess.PIPE).stdout.decode("ascii").split("\0"): if "test" in fn: continue if fn.endswith(".rst"): continue # Permit all the reStructuredText files if b"text" not in subprocess.run(["file",fn],stdout=subprocess.PIPE).stdout: continue with open(fn,"rb") as f: for l,line in enumerate(f,1): ln = line # There are some terms that keep coming up. It's not interesting to # see them over and over; we know they're acceptable non-ASCII text. for term in ( # Names of various Pythonistas "Martin v. Löwis","Lars Gustäbel","Peter Åstrand","Marc-André Lemburg", "Gerhard Häring","Martin von Löwis","Łukasz Langa","Björn König", # Symbols "©","∞","π", "\ufeff