dotfiles/vscode/.vscode/extensions/ms-python.black-formatter-2024.2.0/bundled/libs/black/schema.py
Errol Sancaktar ff17c17e23 vscode
2024-06-14 09:31:58 -06:00

21 lines
617 B
Python

import importlib.resources
import json
import sys
from typing import Any
def get_schema(tool_name: str = "black") -> Any:
"""Get the stored complete schema for black's settings."""
assert tool_name == "black", "Only black is supported."
pkg = "black.resources"
fname = "black.schema.json"
if sys.version_info < (3, 9):
with importlib.resources.open_text(pkg, fname, encoding="utf-8") as f:
return json.load(f)
schema = importlib.resources.files(pkg).joinpath(fname) # type: ignore[unreachable]
with schema.open(encoding="utf-8") as f:
return json.load(f)