##// END OF EJS Templates
interfaces: make `dirstate` Protocol class methods abstract...
interfaces: make `dirstate` Protocol class methods abstract Now all known Protocol methods that should be implemented by the subclass are abstract. See cdd4bc69bfc1 for details. Note that this will break the `git` extension more, because there are a bunch of methods that aren't implemented that should be, in favor of some very old methods that won't be called (like `add()` and `drop()`). It's already broken, so I'm not taking the time to figure out how to modernize it right now. It's not detected by pytype because the only instantiation of `gitdirstate` is in `git/__init__.py`, which was already excluded from pytype checking for some other reason. AT least with this, it 1) doesn't get forgotten about, and 2) will require changing the interface if/when the core dirstate class evolves.

File last commit:

r53327:31c49870 default
r53405:2ac368d0 default
Show More
filtertraceback.py
48 lines | 1.3 KiB | text/x-python | PythonLexer
#!/usr/bin/env python3
# Filters traceback lines from stdin.
import io
import sys
# Prevent \r from being inserted on Windows.
sys.stdout = io.TextIOWrapper(
sys.stdout.buffer,
sys.stdout.encoding,
sys.stdout.errors,
newline="\n",
line_buffering=sys.stdout.line_buffering,
)
state = 'none'
for line in sys.stdin:
if state == 'none':
if line.startswith('Traceback '):
state = 'tb'
elif state == 'tb':
if line.startswith(' File '):
state = 'file'
continue
elif not line.startswith(' '):
state = 'none'
elif not line.replace('^', '').replace('~', '').strip():
# PEP 657: Fine-grained error locations in tracebacks
# ~~~~~~^^^^^^^^^
continue
elif state == 'file':
# Ignore one line after " File ", but sometimes "File" lines are
# contiguous:
# File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
# File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
# File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
if not line.startswith(' File '):
state = 'tb'
continue
print(line, end='')