[flake8-simplify] Complete stubs (#14259)

This commit is contained in:
Semyon Moroz
2025-07-07 14:56:47 +00:00
committed by GitHub
parent 213e696e3f
commit 571cbf36d4
18 changed files with 139 additions and 4 deletions
-4
View File
@@ -1,6 +1,2 @@
version = "0.22.*"
upstream_repository = "https://github.com/MartinThoma/flake8-simplify"
partial_stub = true
[tool.stubtest]
ignore_missing_stub = true
@@ -1,9 +1,30 @@
import ast
import logging
from collections.abc import Generator
from typing import Any, ClassVar
logger: logging.Logger
class Visitor(ast.NodeVisitor):
def __init__(self) -> None: ...
def visit_Assign(self, node: ast.Assign) -> None: ...
def visit_Call(self, node: ast.Call) -> None: ...
def visit_With(self, node: ast.With) -> None: ...
def visit_Expr(self, node: ast.Expr) -> None: ...
def visit_BoolOp(self, node: ast.BoolOp) -> None: ...
def visit_If(self, node: ast.If) -> None: ...
def visit_For(self, node: ast.For) -> None: ...
def visit_Subscript(self, node: ast.Subscript) -> None: ...
def visit_Try(self, node: ast.Try) -> None: ...
def visit_UnaryOp(self, node_v: ast.UnaryOp) -> None: ...
def visit_IfExp(self, node: ast.IfExp) -> None: ...
def visit_Compare(self, node: ast.Compare) -> None: ...
def visit_ClassDef(self, node: ast.ClassDef) -> None: ...
class Plugin:
name: ClassVar[str]
version: ClassVar[str]
def __init__(self, tree: ast.AST) -> None: ...
def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]: ...
def add_meta(root: ast.AST, level: int = 0) -> None: ...
@@ -0,0 +1,3 @@
BOOL_CONST_TYPES: tuple[type, ...]
AST_CONST_TYPES: tuple[type, ...]
STR_TYPES: tuple[type, ...]
@@ -0,0 +1,6 @@
import ast
from flake8_simplify.utils import Assign
def get_sim904(node: ast.Assign) -> list[tuple[int, int, str]]: ...
def get_sim909(node: Assign) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,8 @@
import ast
def get_sim101(node: ast.BoolOp) -> list[tuple[int, int, str]]: ...
def get_sim109(node: ast.BoolOp) -> list[tuple[int, int, str]]: ...
def get_sim220(node: ast.BoolOp) -> list[tuple[int, int, str]]: ...
def get_sim221(node: ast.BoolOp) -> list[tuple[int, int, str]]: ...
def get_sim222(node: ast.BoolOp) -> list[tuple[int, int, str]]: ...
def get_sim223(node: ast.BoolOp) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,13 @@
import ast
import logging
from flake8_simplify.utils import Call
logger: logging.Logger
def get_sim115(node: Call) -> list[tuple[int, int, str]]: ...
def get_sim901(node: ast.Call) -> list[tuple[int, int, str]]: ...
def get_sim905(node: ast.Call) -> list[tuple[int, int, str]]: ...
def get_sim906(node: ast.Call) -> list[tuple[int, int, str]]: ...
def get_sim910(node: Call) -> list[tuple[int, int, str]]: ...
def get_sim911(node: ast.AST) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,3 @@
import ast
def get_sim120(node: ast.ClassDef) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,4 @@
import ast
def get_sim118(node: ast.Compare) -> list[tuple[int, int, str]]: ...
def get_sim300(node: ast.Compare) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,3 @@
import ast
def get_sim112(node: ast.Expr) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,7 @@
import ast
from flake8_simplify.utils import For
def get_sim104(node: ast.For) -> list[tuple[int, int, str]]: ...
def get_sim110_sim111(node: ast.For) -> list[tuple[int, int, str]]: ...
def get_sim113(node: For) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,11 @@
import ast
from flake8_simplify.utils import If
def get_sim102(node: ast.If) -> list[tuple[int, int, str]]: ...
def get_sim103(node: ast.If) -> list[tuple[int, int, str]]: ...
def get_sim108(node: If) -> list[tuple[int, int, str]]: ...
def get_sim114(node: ast.If) -> list[tuple[int, int, str]]: ...
def get_sim116(node: ast.If) -> list[tuple[int, int, str]]: ...
def get_sim908(node: ast.If) -> list[tuple[int, int, str]]: ...
def get_sim401(node: ast.If) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,5 @@
import ast
def get_sim210(node: ast.IfExp) -> list[tuple[int, int, str]]: ...
def get_sim211(node: ast.IfExp) -> list[tuple[int, int, str]]: ...
def get_sim212(node: ast.IfExp) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,3 @@
import ast
def get_sim907(node: ast.Subscript) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,4 @@
import ast
def get_sim105(node: ast.Try) -> list[tuple[int, int, str]]: ...
def get_sim107(node: ast.Try) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,8 @@
import ast
from flake8_simplify.utils import UnaryOp
def get_sim201(node: UnaryOp) -> list[tuple[int, int, str]]: ...
def get_sim202(node: UnaryOp) -> list[tuple[int, int, str]]: ...
def get_sim203(node: UnaryOp) -> list[tuple[int, int, str]]: ...
def get_sim208(node: ast.UnaryOp) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,3 @@
import ast
def get_sim117(node: ast.With) -> list[tuple[int, int, str]]: ...
@@ -0,0 +1,37 @@
import ast
from _typeshed import Incomplete
class UnaryOp(ast.UnaryOp):
parent: ast.Expr
def __init__(self, orig: ast.UnaryOp) -> None: ...
class Call(ast.Call):
parent: ast.Expr
def __init__(self, orig: ast.Call) -> None: ...
class If(ast.If):
parent: ast.Expr
def __init__(self, orig: ast.If) -> None: ...
class For(ast.For):
parent: ast.AST
previous_sibling: Incomplete
def __init__(self, orig: ast.For) -> None: ...
class Assign(ast.Assign):
parent: ast.AST
previous_sibling: Incomplete
def __init__(self, orig: ast.Assign) -> None: ...
def to_source(node: ast.expr | ast.Expr | ast.withitem | ast.slice | ast.Assign | None) -> str: ...
def strip_parenthesis(string: str) -> str: ...
def strip_triple_quotes(string: str) -> str: ...
def use_double_quotes(string: str) -> str: ...
def is_body_same(body1: list[ast.stmt], body2: list[ast.stmt]) -> bool: ...
def is_stmt_equal(a: ast.stmt, b: ast.stmt) -> bool: ...
def get_if_body_pairs(node: ast.If) -> list[tuple[ast.expr, list[ast.stmt]]]: ...
def is_constant_increase(expr: ast.AugAssign) -> bool: ...
def is_exception_check(node: ast.If) -> bool: ...
def is_same_expression(a: ast.expr, b: ast.expr) -> bool: ...
def expression_uses_variable(expr: ast.expr, var: str) -> bool: ...
def body_contains_continue(stmts: list[ast.stmt]) -> bool: ...