mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
parent
03d8679adf
commit
e17e1e860b
18 changed files with 76 additions and 39 deletions
|
@ -1 +1 @@
|
|||
f65bdc1acde54fda93c802459280da74518d2eef
|
||||
eec809d049d10a5ae9b88780eab15fe36a9768d7
|
||||
|
|
|
@ -36,7 +36,10 @@ def spec_from_file_location(
|
|||
loader: LoaderProtocol | None = None,
|
||||
submodule_search_locations: list[str] | None = ...,
|
||||
) -> importlib.machinery.ModuleSpec | None: ...
|
||||
|
||||
@deprecated(
|
||||
"Deprecated as of Python 3.6: Use site configuration instead. "
|
||||
"Future versions of Python may not enable this finder by default."
|
||||
)
|
||||
class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
|
||||
if sys.version_info < (3, 12):
|
||||
@classmethod
|
||||
|
@ -118,6 +121,13 @@ class FileLoader:
|
|||
class SourceFileLoader(importlib.abc.FileLoader, FileLoader, importlib.abc.SourceLoader, SourceLoader): # type: ignore[misc] # incompatible method arguments in base classes
|
||||
def set_data(self, path: str, data: ReadableBuffer, *, _mode: int = 0o666) -> None: ...
|
||||
def path_stats(self, path: str) -> Mapping[str, Any]: ...
|
||||
def source_to_code( # type: ignore[override] # incompatible with InspectLoader.source_to_code
|
||||
self,
|
||||
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
path: ReadableBuffer | StrPath,
|
||||
*,
|
||||
_optimize: int = -1,
|
||||
) -> types.CodeType: ...
|
||||
|
||||
class SourcelessFileLoader(importlib.abc.FileLoader, FileLoader, _LoaderBasics):
|
||||
def get_code(self, fullname: str) -> types.CodeType | None: ...
|
||||
|
|
|
@ -1893,8 +1893,12 @@ if sys.version_info >= (3, 14):
|
|||
def compare(left: AST, right: AST, /, *, compare_attributes: bool = False) -> bool: ...
|
||||
|
||||
class NodeVisitor:
|
||||
# All visit methods below can be overwritten by subclasses and return an
|
||||
# arbitrary value, which is passed to the caller.
|
||||
def visit(self, node: AST) -> Any: ...
|
||||
def generic_visit(self, node: AST) -> Any: ...
|
||||
# The following visit methods are not defined on NodeVisitor, but can
|
||||
# be implemented by subclasses and are called during a visit if defined.
|
||||
def visit_Module(self, node: Module) -> Any: ...
|
||||
def visit_Interactive(self, node: Interactive) -> Any: ...
|
||||
def visit_Expression(self, node: Expression) -> Any: ...
|
||||
|
|
|
@ -179,7 +179,7 @@ class AsyncExitStack(_BaseExitStack[_ExitT_co], metaclass=abc.ABCMeta):
|
|||
async def __aenter__(self) -> Self: ...
|
||||
async def __aexit__(
|
||||
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
|
||||
) -> bool: ...
|
||||
) -> _ExitT_co: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
class nullcontext(AbstractContextManager[_T, None], AbstractAsyncContextManager[_T, None]):
|
||||
|
|
|
@ -23,11 +23,6 @@ COLOR_PAIRS: int
|
|||
|
||||
def wrapper(func: Callable[Concatenate[window, _P], _T], /, *arg: _P.args, **kwds: _P.kwargs) -> _T: ...
|
||||
|
||||
# typeshed used the name _CursesWindow for the underlying C class before
|
||||
# it was mapped to the name 'window' in 3.8.
|
||||
# Kept here as a legacy alias in case any third-party code is relying on it.
|
||||
_CursesWindow = window
|
||||
|
||||
# At runtime this class is unexposed and calls itself curses.ncurses_version.
|
||||
# That name would conflict with the actual curses.ncurses_version, which is
|
||||
# an instance of this class.
|
||||
|
|
|
@ -17,9 +17,9 @@ TOKEN_ENDS: Final[set[str]]
|
|||
ASPECIALS: Final[set[str]]
|
||||
ATTRIBUTE_ENDS: Final[set[str]]
|
||||
EXTENDED_ATTRIBUTE_ENDS: Final[set[str]]
|
||||
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
NLSET: Final[set[str]]
|
||||
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
SPECIALSNL: Final[set[str]]
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
|
|
|
@ -23,7 +23,7 @@ class _PolicyBase(Generic[_MessageT]):
|
|||
raise_on_defect: bool
|
||||
mangle_from_: bool
|
||||
message_factory: _MessageFactory[_MessageT] | None
|
||||
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
verify_generated_headers: bool
|
||||
|
||||
def __init__(
|
||||
|
@ -35,7 +35,7 @@ class _PolicyBase(Generic[_MessageT]):
|
|||
raise_on_defect: bool = False,
|
||||
mangle_from_: bool = ..., # default depends on sub-class
|
||||
message_factory: _MessageFactory[_MessageT] | None = None,
|
||||
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
verify_generated_headers: bool = True,
|
||||
) -> None: ...
|
||||
def clone(
|
||||
|
@ -47,7 +47,7 @@ class _PolicyBase(Generic[_MessageT]):
|
|||
raise_on_defect: bool = ...,
|
||||
mangle_from_: bool = ...,
|
||||
message_factory: _MessageFactory[_MessageT] | None = ...,
|
||||
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
verify_generated_headers: bool = ...,
|
||||
) -> Self: ...
|
||||
def __add__(self, other: Policy) -> Self: ...
|
||||
|
|
|
@ -7,7 +7,7 @@ class BoundaryError(MessageParseError): ...
|
|||
class MultipartConversionError(MessageError, TypeError): ...
|
||||
class CharsetError(MessageError): ...
|
||||
|
||||
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
class HeaderWriteError(MessageError): ...
|
||||
|
||||
class MessageDefect(ValueError):
|
||||
|
|
|
@ -24,7 +24,7 @@ class EmailPolicy(Policy[_MessageT]):
|
|||
raise_on_defect: bool = ...,
|
||||
mangle_from_: bool = ...,
|
||||
message_factory: None = None,
|
||||
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
verify_generated_headers: bool = ...,
|
||||
utf8: bool = ...,
|
||||
refold_source: str = ...,
|
||||
|
@ -41,7 +41,7 @@ class EmailPolicy(Policy[_MessageT]):
|
|||
raise_on_defect: bool = ...,
|
||||
mangle_from_: bool = ...,
|
||||
message_factory: _MessageFactory[_MessageT] | None = ...,
|
||||
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
verify_generated_headers: bool = ...,
|
||||
utf8: bool = ...,
|
||||
refold_source: str = ...,
|
||||
|
@ -62,7 +62,7 @@ class EmailPolicy(Policy[_MessageT]):
|
|||
raise_on_defect: bool = ...,
|
||||
mangle_from_: bool = ...,
|
||||
message_factory: _MessageFactory[_MessageT] | None = ...,
|
||||
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
verify_generated_headers: bool = ...,
|
||||
utf8: bool = ...,
|
||||
refold_source: str = ...,
|
||||
|
|
|
@ -30,11 +30,11 @@ _PDTZ: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int | None
|
|||
def quote(str: str) -> str: ...
|
||||
def unquote(str: str) -> str: ...
|
||||
|
||||
# `strict` parameter added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# `strict` parameter added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
def parseaddr(addr: str | list[str], *, strict: bool = True) -> tuple[str, str]: ...
|
||||
def formataddr(pair: tuple[str | None, str], charset: str | Charset = "utf-8") -> str: ...
|
||||
|
||||
# `strict` parameter added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
# `strict` parameter added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
||||
def getaddresses(fieldvalues: Iterable[str], *, strict: bool = True) -> list[tuple[str, str]]: ...
|
||||
@overload
|
||||
def parsedate(data: None) -> None: ...
|
||||
|
|
|
@ -299,6 +299,7 @@ if sys.version_info >= (3, 11):
|
|||
def __or__(self, other: int) -> Self: ...
|
||||
def __and__(self, other: int) -> Self: ...
|
||||
def __xor__(self, other: int) -> Self: ...
|
||||
def __invert__(self) -> Self: ...
|
||||
__ror__ = __or__
|
||||
__rand__ = __and__
|
||||
__rxor__ = __xor__
|
||||
|
@ -309,6 +310,7 @@ else:
|
|||
def __or__(self, other: int) -> Self: ...
|
||||
def __and__(self, other: int) -> Self: ...
|
||||
def __xor__(self, other: int) -> Self: ...
|
||||
def __invert__(self) -> Self: ...
|
||||
__ror__ = __or__
|
||||
__rand__ = __and__
|
||||
__rxor__ = __xor__
|
||||
|
|
|
@ -8,6 +8,7 @@ from importlib import _bootstrap_external
|
|||
from importlib.machinery import ModuleSpec
|
||||
from io import BufferedReader
|
||||
from typing import IO, Any, Literal, Protocol, overload, runtime_checkable
|
||||
from typing_extensions import deprecated
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = [
|
||||
|
@ -38,6 +39,7 @@ else:
|
|||
if sys.version_info < (3, 12):
|
||||
class Finder(metaclass=ABCMeta): ...
|
||||
|
||||
@deprecated("Deprecated as of Python 3.7: Use importlib.resources.abc.TraversableResources instead.")
|
||||
class ResourceLoader(Loader):
|
||||
@abstractmethod
|
||||
def get_data(self, path: str) -> bytes: ...
|
||||
|
@ -58,6 +60,7 @@ class ExecutionLoader(InspectLoader):
|
|||
def get_filename(self, fullname: str) -> str: ...
|
||||
|
||||
class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLoader, metaclass=ABCMeta): # type: ignore[misc] # incompatible definitions of source_to_code in the base classes
|
||||
@deprecated("Deprecated as of Python 3.3: Use importlib.resources.abc.SourceLoader.path_stats instead.")
|
||||
def path_mtime(self, path: str) -> float: ...
|
||||
def set_data(self, path: str, data: bytes) -> None: ...
|
||||
def get_source(self, fullname: str) -> str | None: ...
|
||||
|
|
|
@ -6,7 +6,7 @@ from collections.abc import Callable, Container, Mapping, MutableMapping
|
|||
from reprlib import Repr
|
||||
from types import MethodType, ModuleType, TracebackType
|
||||
from typing import IO, Any, AnyStr, Final, NoReturn, Protocol, TypeVar
|
||||
from typing_extensions import TypeGuard
|
||||
from typing_extensions import TypeGuard, deprecated
|
||||
|
||||
__all__ = ["help"]
|
||||
|
||||
|
@ -31,7 +31,14 @@ def stripid(text: str) -> str: ...
|
|||
def allmethods(cl: type) -> MutableMapping[str, MethodType]: ...
|
||||
def visiblename(name: str, all: Container[str] | None = None, obj: object = None) -> bool: ...
|
||||
def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ...
|
||||
def ispackage(path: str) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
@deprecated("Deprecated in Python 3.13.")
|
||||
def ispackage(path: str) -> bool: ...
|
||||
|
||||
else:
|
||||
def ispackage(path: str) -> bool: ...
|
||||
|
||||
def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ...
|
||||
def synopsis(filename: str, cache: MutableMapping[str, tuple[int, str]] = {}) -> str | None: ...
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ flags: _flags
|
|||
# This can be re-visited when typeshed drops support for 3.10,
|
||||
# at which point all supported versions will include int_max_str_digits
|
||||
# in all patch versions.
|
||||
# 3.8 and 3.9 are 15 or 16-tuple
|
||||
# 3.9 is 15 or 16-tuple
|
||||
# 3.10 is 16 or 17-tuple
|
||||
# 3.11+ is an 18-tuple.
|
||||
@final
|
||||
|
@ -184,7 +184,7 @@ class _flags(_UninstantiableStructseq, tuple[int, ...]):
|
|||
# Whether or not this exists on lower versions of Python
|
||||
# may depend on which patch release you're using
|
||||
# (it was backported to all Python versions on 3.8+ as a security fix)
|
||||
# Added in: 3.8.14, 3.9.14, 3.10.7
|
||||
# Added in: 3.9.14, 3.10.7
|
||||
# and present in all versions of 3.11 and later.
|
||||
@property
|
||||
def int_max_str_digits(self) -> int: ...
|
||||
|
@ -448,7 +448,7 @@ if sys.platform == "win32":
|
|||
def get_coroutine_origin_tracking_depth() -> int: ...
|
||||
def set_coroutine_origin_tracking_depth(depth: int) -> None: ...
|
||||
|
||||
# The following two functions were added in 3.11.0, 3.10.7, 3.9.14, and 3.8.14,
|
||||
# The following two functions were added in 3.11.0, 3.10.7, and 3.9.14,
|
||||
# as part of the response to CVE-2020-10735
|
||||
def set_int_max_str_digits(maxdigits: int) -> None: ...
|
||||
def get_int_max_str_digits() -> int: ...
|
||||
|
|
|
@ -7,7 +7,7 @@ from collections.abc import Callable, Iterable, Iterator, Mapping
|
|||
from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj
|
||||
from types import TracebackType
|
||||
from typing import IO, ClassVar, Literal, Protocol, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
|
||||
__all__ = [
|
||||
"TarFile",
|
||||
|
@ -622,7 +622,6 @@ class TarInfo:
|
|||
offset: int
|
||||
offset_data: int
|
||||
sparse: bytes | None
|
||||
tarfile: TarFile | None
|
||||
mode: int
|
||||
type: bytes
|
||||
linkname: str
|
||||
|
@ -632,6 +631,16 @@ class TarInfo:
|
|||
gname: str
|
||||
pax_headers: Mapping[str, str]
|
||||
def __init__(self, name: str = "") -> None: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
@property
|
||||
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.16")
|
||||
def tarfile(self) -> TarFile | None: ...
|
||||
@tarfile.setter
|
||||
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.16")
|
||||
def tarfile(self, tarfile: TarFile | None) -> None: ...
|
||||
else:
|
||||
tarfile: TarFile | None
|
||||
|
||||
@classmethod
|
||||
def frombuf(cls, buf: bytes | bytearray, encoding: str, errors: str) -> Self: ...
|
||||
@classmethod
|
||||
|
|
|
@ -5,6 +5,7 @@ from _typeshed import ProfileFunction, TraceFunction
|
|||
from collections.abc import Callable, Iterable, Mapping
|
||||
from types import TracebackType
|
||||
from typing import Any, TypeVar, final
|
||||
from typing_extensions import deprecated
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
|
@ -44,9 +45,11 @@ if sys.version_info >= (3, 12):
|
|||
_profile_hook: ProfileFunction | None
|
||||
|
||||
def active_count() -> int: ...
|
||||
def activeCount() -> int: ... # deprecated alias for active_count()
|
||||
@deprecated("Use active_count() instead")
|
||||
def activeCount() -> int: ...
|
||||
def current_thread() -> Thread: ...
|
||||
def currentThread() -> Thread: ... # deprecated alias for current_thread()
|
||||
@deprecated("Use current_thread() instead")
|
||||
def currentThread() -> Thread: ...
|
||||
def get_ident() -> int: ...
|
||||
def enumerate() -> list[Thread]: ...
|
||||
def main_thread() -> Thread: ...
|
||||
|
@ -89,11 +92,14 @@ class Thread:
|
|||
@property
|
||||
def native_id(self) -> int | None: ... # only available on some platforms
|
||||
def is_alive(self) -> bool: ...
|
||||
# the following methods are all deprecated
|
||||
def getName(self) -> str: ...
|
||||
def setName(self, name: str) -> None: ...
|
||||
@deprecated("Get the daemon attribute instead")
|
||||
def isDaemon(self) -> bool: ...
|
||||
@deprecated("Set the daemon attribute instead")
|
||||
def setDaemon(self, daemonic: bool) -> None: ...
|
||||
@deprecated("Use the name attribute instead")
|
||||
def getName(self) -> str: ...
|
||||
@deprecated("Use the name attribute instead")
|
||||
def setName(self, name: str) -> None: ...
|
||||
|
||||
class _DummyThread(Thread):
|
||||
def __init__(self) -> None: ...
|
||||
|
@ -124,7 +130,8 @@ class Condition:
|
|||
def wait_for(self, predicate: Callable[[], _T], timeout: float | None = None) -> _T: ...
|
||||
def notify(self, n: int = 1) -> None: ...
|
||||
def notify_all(self) -> None: ...
|
||||
def notifyAll(self) -> None: ... # deprecated alias for notify_all()
|
||||
@deprecated("Use notify_all() instead")
|
||||
def notifyAll(self) -> None: ...
|
||||
|
||||
class Semaphore:
|
||||
_value: int
|
||||
|
@ -138,7 +145,8 @@ class BoundedSemaphore(Semaphore): ...
|
|||
|
||||
class Event:
|
||||
def is_set(self) -> bool: ...
|
||||
def isSet(self) -> bool: ... # deprecated alias for is_set()
|
||||
@deprecated("Use is_set() instead")
|
||||
def isSet(self) -> bool: ...
|
||||
def set(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def wait(self, timeout: float | None = None) -> bool: ...
|
||||
|
|
|
@ -977,6 +977,7 @@ class Tk(Misc, Wm):
|
|||
sync: bool = False,
|
||||
use: str | None = None,
|
||||
) -> None: ...
|
||||
# Keep this in sync with ttktheme.ThemedTk. See issue #13858
|
||||
@overload
|
||||
def configure(
|
||||
self,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import sys
|
||||
from _typeshed import MaybeNone
|
||||
from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, Sequence
|
||||
from contextlib import _GeneratorContextManager
|
||||
from types import TracebackType
|
||||
|
@ -69,16 +70,13 @@ _CallValue: TypeAlias = str | tuple[Any, ...] | Mapping[str, Any] | _ArgsKwargs
|
|||
|
||||
class _Call(tuple[Any, ...]):
|
||||
def __new__(
|
||||
cls, value: _CallValue = (), name: str | None = "", parent: Any | None = None, two: bool = False, from_kall: bool = True
|
||||
cls, value: _CallValue = (), name: str | None = "", parent: _Call | None = None, two: bool = False, from_kall: bool = True
|
||||
) -> Self: ...
|
||||
name: Any
|
||||
parent: Any
|
||||
from_kall: Any
|
||||
def __init__(
|
||||
self,
|
||||
value: _CallValue = (),
|
||||
name: str | None = None,
|
||||
parent: Any | None = None,
|
||||
parent: _Call | None = None,
|
||||
two: bool = False,
|
||||
from_kall: bool = True,
|
||||
) -> None: ...
|
||||
|
@ -162,7 +160,7 @@ class NonCallableMock(Base, Any):
|
|||
side_effect: Any
|
||||
called: bool
|
||||
call_count: int
|
||||
call_args: Any
|
||||
call_args: _Call | MaybeNone
|
||||
call_args_list: _CallList
|
||||
mock_calls: _CallList
|
||||
def _format_mock_call_signature(self, args: Any, kwargs: Any) -> str: ...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue