Mercurial > hg
view contrib/setup-pytype.sh @ 52128:0c260e7158e0
typing: suppress bogus pytype errors in `mercurial/wireprotoframing.py`
This fixes:
File "/mnt/c/Users/Matt/hg/mercurial/wireprotoframing.py", line 480, in createalternatelocationresponseframe:
unsupported operand type(s) for item assignment: bytes [unsupported-operands]
No attribute '__setitem__' on bytes
File "/mnt/c/Users/Matt/hg/mercurial/wireprotoframing.py", line 510, in createcommanderrorresponse:
unsupported operand type(s) for item assignment: bytes [unsupported-operands]
No attribute '__setitem__' on bytes
File "/mnt/c/Users/Matt/hg/mercurial/wireprotoframing.py", line 776, in __init__:
Can't find module 'mercurial.zstd'. [import-error]
File "/mnt/c/Users/Matt/hg/mercurial/wireprotoframing.py", line 804, in __init__:
Can't find module 'mercurial.zstd'. [import-error]
File "/mnt/c/Users/Matt/hg/mercurial/wireprotoframing.py", line 834, in populatestreamencoders:
Can't find module 'mercurial.zstd'. [import-error]
Using `TypedDict` is tempting here to fix the first two, but requires str keys.
The code doing the importing doesn't call the code at the other three locations
if the `mercurial.zstd` module fails to import in a place that handles the
ImportError.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 25 Oct 2024 23:07:34 -0400 |
parents | 832a1aeb576f |
children |
line wrap: on
line source
#!/bin/bash set -e set -u # Find the python3 setup that would run pytype PYTYPE=`which pytype` PYTHON3=${PYTHON:-`head -n1 ${PYTYPE} | sed -s 's/#!//'`} # Existing stubs that pytype processes live here TYPESHED=$(${PYTHON3} -c "import pytype; print(pytype.__path__[0])")/typeshed/stubs HG_STUBS=${TYPESHED}/mercurial echo "Patching typeshed at $HG_STUBS" rm -rf ${HG_STUBS} mkdir -p ${HG_STUBS} cat > ${HG_STUBS}/METADATA.toml <<EOF version = "0.1" EOF mkdir -p ${HG_STUBS}/mercurial/cext ${HG_STUBS}/mercurial/thirdparty/attr touch ${HG_STUBS}/mercurial/__init__.pyi touch ${HG_STUBS}/mercurial/cext/__init__.pyi touch ${HG_STUBS}/mercurial/thirdparty/__init__.pyi ln -sf $(hg root)/mercurial/cext/*.{pyi,typed} \ ${HG_STUBS}/mercurial/cext ln -sf $(hg root)/mercurial/thirdparty/attr/*.{pyi,typed} \ ${HG_STUBS}/mercurial/thirdparty/attr