evan.liu 1948e4b1ba tools: commit the bundled production runtime (python-embed + NSpyocd + DFP pack)
Per request the full portable environment is now in git: a fresh clone's
tools/ runs everything with zero installation. Only regenerable release
zips and the dev venv stay ignored.
2026-09-05 10:38:43 +08:00

22 lines
594 B
Python

import sys
from collections.abc import Sized
from typing import Protocol
if sys.version_info < (3, 12):
# mypy and pyright object to Buffer being both ABC and Protocol. Work around
# by just inheriting from Protocol here. typing_extensions.Buffer is just
# abc.ABC.
class BufferProtocol(Protocol):
def __buffer__(self, flags: int, /) -> memoryview: ...
else:
from collections.abc import Buffer as BufferProtocol
class SizedBuffer(BufferProtocol, Sized, Protocol):
"""
Protocol for types that are both Buffer and Sized.
.. versionadded:: 2.1
"""