repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: e05c5c0818279e5ac248ac9e954431ba58865e61 # frozen: v0.15.7
+ rev: 3b3f7c3f57fe9925356faf5fe6230835138be230 # frozen: v0.15.17
hooks:
- id: ruff-check
name: Run Ruff (lint) on Platforms/Apple/
name: Run Ruff (lint) on Doc/
args: [--exit-non-zero-on-fix]
files: ^Doc/
+ - id: ruff-check
+ name: Run Ruff (lint) on Lib/
+ args: [--exit-non-zero-on-fix]
+ files: ^Lib/
+ exclude: ^Lib/test/
- id: ruff-check
name: Run Ruff (lint) on Lib/test/
args: [--exit-non-zero-on-fix]
name: Run Ruff (lint) on Platforms/WASI/
args: [--exit-non-zero-on-fix, --config=Platforms/WASI/.ruff.toml]
files: ^Platforms/WASI/
+ - id: ruff-check
+ name: Run Ruff (lint) on Tools/
+ args: [--exit-non-zero-on-fix]
+ files: ^Tools/
+ exclude: ^Tools/(build|clinic|i18n|peg_generator|wasm)/
- id: ruff-check
name: Run Ruff (lint) on Tools/build/
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]
--- /dev/null
+extend = "../.ruff.toml" # Inherit the project-wide settings
+
+# Unlike Tools/, stdlib can use newer syntax than PYTHON_FOR_REGEN
+target-version = "py315"
+
+[lint]
+select = [
+ "F401", # Unused import
+]
+
+[lint.per-file-ignores]
+"ctypes/__init__.py" = ["F401"] # Re-exports from _ctypes
+"ensurepip/__init__.py" = ["F401"] # `import zlib` availability check
+"idlelib/idle_test/htest.py" = ["F401"] # Import for Windows DPI side effect
+"idlelib/idle_test/test_iomenu.py" = ["F401"] # Imports checked for existence
+"importlib/_abc.py" = ["F401"] # Bootstrap-sensitive _bootstrap import
+"importlib/machinery.py" = ["F401"] # NamespacePath re-export
+"importlib/metadata/__init__.py" = ["F401"] # Synced from importlib_metadata
+"profiling/sampling/sample.py" = ["F401"] # Re-exports PROFILING_MODE_* constants
+"ssl.py" = ["F401"] # Re-exports from _ssl
+"warnings.py" = ["F401"] # Re-exports from _py_warnings
# types
Command = commands.Command
if TYPE_CHECKING:
- from .types import CommandName, CompletionAction, Keymap, KeySpec
+ from .types import CompletionAction, Keymap
def prefix(wordlist: list[str], j: int = 0) -> str:
)
from .layout import LayoutMap, LayoutResult, LayoutRow, WrappedRow, layout_content_lines
from .render import RenderCell, RenderLine, RenderedScreen, ScreenOverlay
-from .utils import ANSI_ESCAPE_SEQUENCE, ColorSpan, THEME, StyleRef, wlen, gen_colors
+from .utils import ANSI_ESCAPE_SEQUENCE, ColorSpan, THEME, StyleRef, gen_colors
from .trace import trace
from collections.abc import Callable
from dataclasses import dataclass
from fcntl import ioctl
-from typing import TYPE_CHECKING, cast, overload
+from typing import TYPE_CHECKING, overload
from . import terminfo
from .console import Console, Event
"Test , coverage %."
-from idlelib import zzdummy
import unittest
from test.support import requires
from tkinter import Tk
import unittest
from test.support import requires
requires('gui')
-from os.path import abspath, dirname, join
from tkinter import Tk
import html
import importlib.resources
import json
-import locale
import math
import os
import platform
-import site
import sys
from dataclasses import dataclass, field
from pathlib import Path
THREAD_STATUS_UNKNOWN,
THREAD_STATUS_GIL_REQUESTED,
THREAD_STATUS_HAS_EXCEPTION,
- PROFILING_MODE_CPU,
- PROFILING_MODE_GIL,
- PROFILING_MODE_WALL,
)
from .constants import (
MICROSECONDS_PER_SECOND,
"""Display interface abstractions for the live profiling collector."""
-import contextlib
import curses
from abc import ABC, abstractmethod
"""Widget classes for the live profiling collector UI."""
import curses
-import time
from abc import ABC, abstractmethod
from .constants import (
WIDTH_THRESHOLD_CUMUL_PCT,
WIDTH_THRESHOLD_CUMTIME,
MICROSECONDS_PER_SECOND,
- DISPLAY_UPDATE_INTERVAL_SEC,
MIN_BAR_WIDTH,
MAX_SAMPLE_RATE_BAR_WIDTH,
MAX_EFFICIENCY_BAR_WIDTH,
MIN_SAMPLE_RATE_FOR_SCALING,
FOOTER_LINES,
- FINISHED_BANNER_EXTRA_LINES,
OPCODE_PANEL_HEIGHT,
)
-from ..constants import (
- THREAD_STATUS_HAS_GIL,
- THREAD_STATUS_ON_CPU,
- THREAD_STATUS_UNKNOWN,
- THREAD_STATUS_GIL_REQUESTED,
- PROFILING_MODE_CPU,
- PROFILING_MODE_GIL,
- PROFILING_MODE_WALL,
-)
+from ..constants import PROFILING_MODE_GIL
from ..opcode_utils import get_opcode_info, format_opcode
from collections import deque
lazy from _colorize import ANSIColors
-from .pstats_collector import PstatsCollector
-from .stack_collector import CollapsedStackCollector, FlamegraphCollector
-from .heatmap_collector import HeatmapCollector
-from .gecko_collector import GeckoCollector
from .binary_collector import BinaryCollector
--- /dev/null
+extend = "../.ruff.toml" # Inherit the project-wide settings
+
+[per-file-target-version]
+"jit/*.py" = "py312" # Reused-quote f-strings (PEP 701)
+
+[lint]
+select = [
+ "F401", # Unused import
+]
+
+[lint.per-file-ignores]
+"c-analyzer/c_parser/__init__.py" = ["F401"] # Re-exports from submodules
+"c-analyzer/c_parser/preprocessor/__init__.py" = ["F401"] # Re-exports from submodules
+"c-analyzer/c_parser/preprocessor/common.py" = ["F401"] # Re-exported by preprocessor/__init__.py