mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
15 lines
427 B
Python
15 lines
427 B
Python
|
|
|
|
class SchemaFileError(Exception):
|
|
"""A schema-file-related operation failed."""
|
|
|
|
|
|
def read_schema(filename, *, _open=open):
|
|
"""Return the data (bytes) in the given schema file."""
|
|
try:
|
|
schemafile = _open(filename, 'rb')
|
|
except FileNotFoundError as exc:
|
|
raise SchemaFileError(
|
|
'schema file {!r} not found'.format(filename))
|
|
with schemafile:
|
|
return schemafile.read()
|