mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-09 22:25:09 +00:00
Use __future__
imports in scripts (#5301)
This commit is contained in:
parent
eaa10ad2d9
commit
f9f0cf7524
11 changed files with 25 additions and 4 deletions
|
@ -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)"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue