Use __future__ imports in scripts (#5301)

This commit is contained in:
Charlie Marsh 2023-06-22 11:40:16 -04:00 committed by GitHub
parent eaa10ad2d9
commit f9f0cf7524
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 25 additions and 4 deletions

View file

@ -1,17 +1,22 @@
#!/usr/bin/env python3
"""Check code snippets in docs are formatted by black."""
from __future__ import annotations
import argparse
import os
import re
import textwrap
from collections.abc import Sequence
from pathlib import Path
from re import Match
from typing import TYPE_CHECKING
import black
from black.mode import Mode, TargetVersion
from black.parsing import InvalidInput
if TYPE_CHECKING:
from collections.abc import Sequence
TARGET_VERSIONS = ["py37", "py38", "py39", "py310", "py311"]
SNIPPED_RE = re.compile(
r"(?P<before>^(?P<indent> *)```\s*python\n)"