支持了 ViperOS 的基本高亮,正在完善对 includes 的支持
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled

This commit is contained in:
TermiNexus committed 2026-08-02 15:25:19 +08:00
1 parent a5d1841126
commit 0be56b39ae
16 files changed
+105 -5622

No files matched your search

@@ -357,18 +357,19 @@ export class ImportResolver {
getImportRoots(execEnv: ExecutionEnvironment, forLogging = false) {
const roots = [];
// Viper 模式:项目 includes(.vpj 中配置的真实 .vp 源文件路径)必须最优先,
// 让 LSP 直接解析真实源码生成注解,而非依赖预写的 .vpi 存根。
// 全局优先:项目 includes(execEnv.extraPaths)与 workspace root 必须排在所有
// fallback 之前,确保 .vpj 中配置的真实 .vp 源码遮蔽 vipershed-fallback /
// typeshed-fallback 中的 .vpi 存根。不再依赖 dialect === 'viper' 判断 —— 只要
// .vpj includes 被解析进 extraPaths(由 _initializeFromViperProjectJson 完成),
// 即优先于所有 fallback,符合"按需过滤,不用存根"原则。
// The "default" workspace has a root-less execution environment; ignore it.
if (IsViperDialect(this._configOptions.dialect)) {
if (execEnv.root) {
roots.push(execEnv.root);
}
appendArray(roots, execEnv.extraPaths);
if (execEnv.root) {
roots.push(execEnv.root);
}
appendArray(roots, execEnv.extraPaths);
// vipershed-fallback/stdlib 作为回退:仅提供 t.vpi/c.vpi 等无真实 .vp 源码
// 的核心模块存根(t.py/c.py 是编译器实现,依赖内部模块无法被 LSP 解析)。
// vipershed-fallback/stdlib 作为回退:仅 Viper 模式下提供 t.vpi/c.vpi 等
// 无真实 .vp 源码的核心模块存根(t.py/c.py 是编译器实现,依赖内部模块无法被 LSP 解析)。
// 排在项目 includes 之后,确保有真实 .vp 的模块优先用源码。
if (IsViperDialect(this._configOptions.dialect)) {
const vipershed = PythonPathUtils.getVipershedFallbackPath(this.fileSystem);
@@ -391,14 +392,6 @@ export class ImportResolver {
roots.push(stdTypeshed);
}
// 非 Viper 模式:保持原有顺序(root 与 extraPaths 在 typeshed 之后)。
if (!IsViperDialect(this._configOptions.dialect)) {
if (execEnv.root) {
roots.push(execEnv.root);
}
appendArray(roots, execEnv.extraPaths);
}
if (this._configOptions.stubPath) {
roots.push(this._configOptions.stubPath);
}
@@ -8396,50 +8396,12 @@ export function createTypeEvaluator(
isViperTypeSetIndex &&
ClassType.isBuiltIn(concreteSubtype, ['str', 'bytes'])
) {
// 从 t 模块中查找 CChar 类型别名,保留 t.CChar 显示信息。
const tSymbolWithScope = lookUpSymbolRecursive(node, 't', /* honorCodeFlow */ true);
if (tSymbolWithScope) {
const tEffectiveType = getEffectiveTypeOfSymbolForUsage(
tSymbolWithScope.symbol,
/* usageNode */ undefined,
/* useLastDecl */ true
).type;
if (tEffectiveType && isModule(tEffectiveType)) {
const ccharSymbol = ModuleType.getField(tEffectiveType, 'CChar');
if (ccharSymbol) {
// 优先使用声明类型(保留 typeAliasInfo)
const ccharDeclType = getDeclaredTypeOfSymbol(ccharSymbol)?.type;
if (ccharDeclType) {
return convertToInstance(ccharDeclType);
}
// 回退到有效类型
const ccharType = getEffectiveTypeOfSymbolForUsage(
ccharSymbol,
/* usageNode */ undefined,
/* useLastDecl */ true
).type;
if (ccharType) {
return convertToInstance(ccharType);
}
}
}
// 构造带 CChar 别名信息的 int 类型(保留 t.CChar 显示信息)
const ccharType = getViperCCharType(node);
if (ccharType) {
return ccharType;
}
// 回退:构造带 CChar 别名信息的 int 类型
const intType = getBuiltInObject(node, 'int');
const ccharAliasInfo: TypeAliasInfo = {
shared: {
name: 'CChar',
fullName: 't.CChar',
moduleName: 't',
fileUri: viperIndexFileInfo.fileUri,
typeVarScopeId: '',
isTypeAliasType: false,
typeParams: undefined,
computedVariance: undefined,
},
typeArgs: undefined,
};
return TypeBase.cloneForTypeAlias(intType, ccharAliasInfo);
return concreteSubtype;
}
// Viper TypeSet:非修饰基本类型(int/float/bool 等)在类型组合中
// 表示指针指向的目标类型(如 CConst | int | CPtr = const int*),
@@ -8452,6 +8414,22 @@ export function createTypeEvaluator(
) {
return concreteSubtype;
}
// Viper 扩展:str/bytes 表示 C 字符串指针(i8* / i8*)。
// 即使不是 TypeSet 联合(纯 str/bytes 注解),下标赋值 a[i] = v 也是
// 合法的指针写字节操作(C 语义),不应报 __setitem__ 不存在。
// 下标读取 a[i] 复用 str 的 __getitem__(返回 int/CChar)。
if (
IsViperDialect(viperIndexFileInfo.executionEnvironment.dialect) &&
ClassType.isBuiltIn(concreteSubtype, ['str', 'bytes']) &&
usage.method !== 'get'
) {
// 构造带 CChar 别名信息的 int 类型作为下标访问的目标类型
const ccharType = getViperCCharType(node);
if (ccharType) {
return ccharType;
}
return concreteSubtype;
}
const typeResult = getTypeOfIndexedObjectOrClass(node, concreteSubtype, selfType, usage);
if (typeResult.isIncomplete) {
isIncomplete = true;
@@ -8636,6 +8614,57 @@ export function createTypeEvaluator(
}
}
// Viper 扩展:构造带 t.CChar 类型别名信息的 int 类型(表示 C 的 char 类型)。
// Viper 中 str/bytes 是 i8* 指针,下标访问返回 t.CChar(int 别名)。
// 优先从 t 模块查找 CChar 类型别名以保留显示信息;找不到时回退为
// 构造带 typeAliasInfo 的 int 类型。查找失败返回 undefined。
function getViperCCharType(node: IndexNode): Type | undefined {
const tSymbolWithScope = lookUpSymbolRecursive(node, 't', /* honorCodeFlow */ true);
if (tSymbolWithScope) {
const tEffectiveType = getEffectiveTypeOfSymbolForUsage(
tSymbolWithScope.symbol,
/* usageNode */ undefined,
/* useLastDecl */ true
).type;
if (tEffectiveType && isModule(tEffectiveType)) {
const ccharSymbol = ModuleType.getField(tEffectiveType, 'CChar');
if (ccharSymbol) {
// 优先使用声明类型(保留 typeAliasInfo)
const ccharDeclType = getDeclaredTypeOfSymbol(ccharSymbol)?.type;
if (ccharDeclType) {
return convertToInstance(ccharDeclType);
}
// 回退到有效类型
const ccharType = getEffectiveTypeOfSymbolForUsage(
ccharSymbol,
/* usageNode */ undefined,
/* useLastDecl */ true
).type;
if (ccharType) {
return convertToInstance(ccharType);
}
}
}
}
// 回退:构造带 CChar 别名信息的 int 类型
const fileInfo = AnalyzerNodeInfo.getFileInfo(node);
const intType = getBuiltInObject(node, 'int');
const ccharAliasInfo: TypeAliasInfo = {
shared: {
name: 'CChar',
fullName: 't.CChar',
moduleName: 't',
fileUri: fileInfo.fileUri,
typeVarScopeId: '',
isTypeAliasType: false,
typeParams: undefined,
computedVariance: undefined,
},
typeArgs: undefined,
};
return TypeBase.cloneForTypeAlias(intType, ccharAliasInfo);
}
function getTypeOfIndexedObjectOrClass(
node: IndexNode,
baseType: ClassType,
@@ -25803,13 +25832,19 @@ export function createTypeEvaluator(
// None(NULL 函数指针语义),允许 def isr0() -> irq_handler_t: pass 或 return None。
// 返回类型包含 C 声明标记(t.State/t.CExport 等)的也接受 None(无返回值),
// 允许 def CloseHandle() -> BOOL | t.State: pass 这类声明性函数的隐式 None。
// str/bytes 在 Viper 中表示 C 字符串指针(i8*),同样接受 None(NULL 字符串指针),
// 允许 def strcpy(...) -> str: ... return None 这类返回 str 的函数返回空指针。
if (isNoneInstance(srcType)) {
if (isPureCModifierType(destType)) {
return true;
}
const destVariants = isUnion(destType) ? destType.priv.subtypes : [destType];
const hasPtrLike = destVariants.some(
(variant) => isCPtrType(variant) || isCVoidType(variant) || isFunction(variant)
(variant) =>
isCPtrType(variant) ||
isCVoidType(variant) ||
isFunction(variant) ||
(isClassInstance(variant) && ClassType.isBuiltIn(variant, ['str', 'bytes']))
);
if (hasPtrLike) {
return true;
@@ -647,6 +647,10 @@ export function getOffDiagnosticRuleSet(dialect?: LanguageDialect): DiagnosticRu
// Viper 扩展:当泛型参数为 Unknown 时省略类型参数显示
// (如 t.CPtr 不带泛型参数时显示为 CPtr,而非 CPtr[Unknown])
diagSettings.omitTypeArgsIfUnknown = true;
// Viper 扩展:None 是空指针(CPtr null),常作为指针类型参数默认值。
// 禁用 strictParameterNoneValue,使 "T = None" 自动扩展为 "T | None"(PEP 484),
// 避免 short: str = None 这类合法的 Viper 指针默认值被误报为类型不兼容。
diagSettings.strictParameterNoneValue = false;
}
return diagSettings;
@@ -768,6 +772,10 @@ export function getBasicDiagnosticRuleSet(dialect?: LanguageDialect): Diagnostic
// Viper 扩展:当泛型参数为 Unknown 时省略类型参数显示
// (如 t.CPtr 不带泛型参数时显示为 CPtr,而非 CPtr[Unknown])
diagSettings.omitTypeArgsIfUnknown = true;
// Viper 扩展:None 是空指针(CPtr null),常作为指针类型参数默认值。
// 禁用 strictParameterNoneValue,使 "T = None" 自动扩展为 "T | None"(PEP 484),
// 避免 short: str = None 这类合法的 Viper 指针默认值被误报为类型不兼容。
diagSettings.strictParameterNoneValue = false;
}
return diagSettings;
@@ -889,6 +897,10 @@ export function getStandardDiagnosticRuleSet(dialect?: LanguageDialect): Diagnos
// Viper 扩展:当泛型参数为 Unknown 时省略类型参数显示
// (如 t.CPtr 不带泛型参数时显示为 CPtr,而非 CPtr[Unknown])
diagSettings.omitTypeArgsIfUnknown = true;
// Viper 扩展:None 是空指针(CPtr null),常作为指针类型参数默认值。
// 禁用 strictParameterNoneValue,使 "T = None" 自动扩展为 "T | None"(PEP 484),
// 避免 short: str = None 这类合法的 Viper 指针默认值被误报为类型不兼容。
diagSettings.strictParameterNoneValue = false;
}
return diagSettings;
@@ -1010,6 +1022,10 @@ export function getStrictDiagnosticRuleSet(dialect?: LanguageDialect): Diagnosti
// Viper 扩展:当泛型参数为 Unknown 时省略类型参数显示
// (如 t.CPtr 不带泛型参数时显示为 CPtr,而非 CPtr[Unknown])
diagSettings.omitTypeArgsIfUnknown = true;
// Viper 扩展:None 是空指针(CPtr null),常作为指针类型参数默认值。
// 禁用 strictParameterNoneValue,使 "T = None" 自动扩展为 "T | None"(PEP 484),
// 避免 short: str = None 这类合法的 Viper 指针默认值被误报为类型不兼容。
diagSettings.strictParameterNoneValue = false;
}
return diagSettings;
@@ -1,864 +0,0 @@
import sys
from _typeshed import SupportsWrite, sentinel
from collections.abc import Callable, Generator, Iterable, Sequence
from re import Pattern
from typing import IO, Any, ClassVar, Final, Generic, NoReturn, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import Self, deprecated
__all__ = [
"ArgumentParser",
"ArgumentError",
"ArgumentTypeError",
"FileType",
"HelpFormatter",
"ArgumentDefaultsHelpFormatter",
"RawDescriptionHelpFormatter",
"RawTextHelpFormatter",
"MetavarTypeHelpFormatter",
"Namespace",
"Action",
"BooleanOptionalAction",
"ONE_OR_MORE",
"OPTIONAL",
"PARSER",
"REMAINDER",
"SUPPRESS",
"ZERO_OR_MORE",
]
_T = TypeVar("_T")
_ActionT = TypeVar("_ActionT", bound=Action)
_ArgumentParserT = TypeVar("_ArgumentParserT", bound=ArgumentParser)
_N = TypeVar("_N")
_ActionType: TypeAlias = Callable[[str], Any] | FileType | str
ONE_OR_MORE: Final = "+"
OPTIONAL: Final = "?"
PARSER: Final = "A..."
REMAINDER: Final = "..."
SUPPRESS: Final = "==SUPPRESS=="
ZERO_OR_MORE: Final = "*"
_UNRECOGNIZED_ARGS_ATTR: Final = "_unrecognized_args" # undocumented
class ArgumentError(Exception):
argument_name: str | None
message: str
def __init__(self, argument: Action | None, message: str) -> None: ...
# undocumented
class _AttributeHolder:
def _get_kwargs(self) -> list[tuple[str, Any]]: ...
def _get_args(self) -> list[Any]: ...
# undocumented
class _ActionsContainer:
description: str | None
prefix_chars: str
argument_default: Any
conflict_handler: str
_registries: dict[str, dict[Any, Any]]
_actions: list[Action]
_option_string_actions: dict[str, Action]
_action_groups: list[_ArgumentGroup]
_mutually_exclusive_groups: list[_MutuallyExclusiveGroup]
_defaults: dict[str, Any]
_negative_number_matcher: Pattern[str]
_has_negative_number_optionals: list[bool]
def __init__(self, description: str | None, prefix_chars: str, argument_default: Any, conflict_handler: str) -> None: ...
def register(self, registry_name: str, value: Any, object: Any) -> None: ...
def _registry_get(self, registry_name: str, value: Any, default: Any = None) -> Any: ...
def set_defaults(self, **kwargs: Any) -> None: ...
def get_default(self, dest: str) -> Any: ...
def add_argument(
self,
*name_or_flags: str,
# str covers predefined actions ("store_true", "count", etc.)
# and user registered actions via the `register` method.
action: str | type[Action] = ...,
# more precisely, Literal["?", "*", "+", "...", "A...", "==SUPPRESS=="],
# but using this would make it hard to annotate callers that don't use a
# literal argument and for subclasses to override this method.
nargs: int | str | None = None,
const: Any = ...,
default: Any = ...,
type: _ActionType = ...,
choices: Iterable[Any] | None = ..., # choices must match the type specified
required: bool = ...,
help: str | None = ...,
metavar: str | tuple[str, ...] | None = ...,
dest: str | None = ...,
version: str = ...,
**kwargs: Any,
) -> Action: ...
@overload
def add_argument_group(
self,
title: str | None = None,
description: str | None = None,
*,
# argument_default's type must be valid for the arguments in the group
argument_default: Any = ...,
conflict_handler: str = ...,
) -> _ArgumentGroup: ...
@overload
@deprecated("The `prefix_chars` parameter deprecated since Python 3.14.")
def add_argument_group(
self,
title: str | None = None,
description: str | None = None,
*,
prefix_chars: str,
argument_default: Any = ...,
conflict_handler: str = ...,
) -> _ArgumentGroup: ...
def add_mutually_exclusive_group(self, *, required: bool = False) -> _MutuallyExclusiveGroup: ...
def _add_action(self, action: _ActionT) -> _ActionT: ...
def _remove_action(self, action: Action) -> None: ...
def _add_container_actions(self, container: _ActionsContainer) -> None: ...
def _get_positional_kwargs(self, dest: str, **kwargs: Any) -> dict[str, Any]: ...
def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
def _pop_action_class(self, kwargs: Any, default: type[Action] | None = None) -> type[Action]: ...
def _get_handler(self) -> Callable[[Action, Iterable[tuple[str, Action]]], Any]: ...
def _check_conflict(self, action: Action) -> None: ...
def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> NoReturn: ...
def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> None: ...
@type_check_only
class _FormatterClass(Protocol):
def __call__(self, *, prog: str) -> HelpFormatter: ...
class ArgumentParser(_AttributeHolder, _ActionsContainer):
prog: str
usage: str | None
epilog: str | None
formatter_class: _FormatterClass
fromfile_prefix_chars: str | None
add_help: bool
allow_abbrev: bool
exit_on_error: bool
if sys.version_info >= (3, 14):
suggest_on_error: bool
color: bool
# undocumented
_positionals: _ArgumentGroup
_optionals: _ArgumentGroup
_subparsers: _ArgumentGroup | None
# Note: the constructor arguments are also used in _SubParsersAction.add_parser.
if sys.version_info >= (3, 15):
def __init__(
self,
prog: str | None = None,
usage: str | None = None,
description: str | None = None,
epilog: str | None = None,
parents: Iterable[ArgumentParser] = [],
formatter_class: _FormatterClass = ...,
prefix_chars: str = "-",
fromfile_prefix_chars: str | None = None,
argument_default: Any = None,
conflict_handler: str = "error",
add_help: bool = True,
allow_abbrev: bool = True,
exit_on_error: bool = True,
*,
suggest_on_error: bool = True,
color: bool = True,
) -> None: ...
elif sys.version_info >= (3, 14):
def __init__(
self,
prog: str | None = None,
usage: str | None = None,
description: str | None = None,
epilog: str | None = None,
parents: Iterable[ArgumentParser] = [],
formatter_class: _FormatterClass = ...,
prefix_chars: str = "-",
fromfile_prefix_chars: str | None = None,
argument_default: Any = None,
conflict_handler: str = "error",
add_help: bool = True,
allow_abbrev: bool = True,
exit_on_error: bool = True,
*,
suggest_on_error: bool = False,
color: bool = True,
) -> None: ...
else:
def __init__(
self,
prog: str | None = None,
usage: str | None = None,
description: str | None = None,
epilog: str | None = None,
parents: Iterable[ArgumentParser] = [],
formatter_class: _FormatterClass = ...,
prefix_chars: str = "-",
fromfile_prefix_chars: str | None = None,
argument_default: Any = None,
conflict_handler: str = "error",
add_help: bool = True,
allow_abbrev: bool = True,
exit_on_error: bool = True,
) -> None: ...
@overload
def parse_args(self, args: Iterable[str] | None = None, namespace: None = None) -> Namespace: ...
@overload
def parse_args(self, args: Iterable[str] | None, namespace: _N) -> _N: ...
@overload
def parse_args(self, *, namespace: _N) -> _N: ...
@overload
def add_subparsers(
self: _ArgumentParserT,
*,
title: str = "subcommands",
description: str | None = None,
prog: str | None = None,
action: type[Action] = ...,
option_string: str = ...,
dest: str | None = None,
required: bool = False,
help: str | None = None,
metavar: str | None = None,
) -> _SubParsersAction[_ArgumentParserT]: ...
@overload
def add_subparsers(
self,
*,
title: str = "subcommands",
description: str | None = None,
prog: str | None = None,
parser_class: type[_ArgumentParserT],
action: type[Action] = ...,
option_string: str = ...,
dest: str | None = None,
required: bool = False,
help: str | None = None,
metavar: str | None = None,
) -> _SubParsersAction[_ArgumentParserT]: ...
def print_usage(self, file: SupportsWrite[str] | None = None) -> None: ...
def print_help(self, file: SupportsWrite[str] | None = None) -> None: ...
if sys.version_info >= (3, 15):
def format_usage(self, formatter: HelpFormatter | None = None) -> str: ...
def format_help(self, formatter: HelpFormatter | None = None) -> str: ...
else:
def format_usage(self) -> str: ...
def format_help(self) -> str: ...
@overload
def parse_known_args(self, args: Iterable[str] | None = None, namespace: None = None) -> tuple[Namespace, list[str]]: ...
@overload
def parse_known_args(self, args: Iterable[str] | None, namespace: _N) -> tuple[_N, list[str]]: ...
@overload
def parse_known_args(self, *, namespace: _N) -> tuple[_N, list[str]]: ...
def convert_arg_line_to_args(self, arg_line: str) -> list[str]: ...
def exit(self, status: int = 0, message: str | None = None) -> NoReturn: ...
def error(self, message: str) -> NoReturn: ...
@overload
def parse_intermixed_args(self, args: Iterable[str] | None = None, namespace: None = None) -> Namespace: ...
@overload
def parse_intermixed_args(self, args: Iterable[str] | None, namespace: _N) -> _N: ...
@overload
def parse_intermixed_args(self, *, namespace: _N) -> _N: ...
@overload
def parse_known_intermixed_args(
self, args: Iterable[str] | None = None, namespace: None = None
) -> tuple[Namespace, list[str]]: ...
@overload
def parse_known_intermixed_args(self, args: Iterable[str] | None, namespace: _N) -> tuple[_N, list[str]]: ...
@overload
def parse_known_intermixed_args(self, *, namespace: _N) -> tuple[_N, list[str]]: ...
# undocumented
def _get_optional_actions(self) -> list[Action]: ...
def _get_positional_actions(self) -> list[Action]: ...
if sys.version_info >= (3, 12):
def _parse_known_args(
self, arg_strings: list[str], namespace: Namespace, intermixed: bool
) -> tuple[Namespace, list[str]]: ...
else:
def _parse_known_args(self, arg_strings: list[str], namespace: Namespace) -> tuple[Namespace, list[str]]: ...
def _read_args_from_files(self, arg_strings: list[str]) -> list[str]: ...
def _match_argument(self, action: Action, arg_strings_pattern: str) -> int: ...
def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: str) -> list[int]: ...
if sys.version_info >= (3, 12):
def _parse_optional(self, arg_string: str) -> list[tuple[Action | None, str, str | None, str | None]] | None: ...
else:
def _parse_optional(self, arg_string: str) -> tuple[Action | None, str, str | None] | None: ...
def _get_option_tuples(self, option_string: str) -> list[tuple[Action, str, str | None]]: ...
def _get_nargs_pattern(self, action: Action) -> str: ...
def _get_values(self, action: Action, arg_strings: list[str]) -> Any: ...
def _get_value(self, action: Action, arg_string: str) -> Any: ...
def _check_value(self, action: Action, value: Any) -> None: ...
if sys.version_info >= (3, 15):
def _get_formatter(self, file: SupportsWrite[str] | None = None) -> HelpFormatter: ...
else:
def _get_formatter(self) -> HelpFormatter: ...
def _print_message(self, message: str, file: SupportsWrite[str] | None = None) -> None: ...
class HelpFormatter:
# undocumented
_prog: str
_indent_increment: int
_max_help_position: int
_width: int
_current_indent: int
_level: int
_action_max_length: int
_root_section: _Section
_current_section: _Section
_whitespace_matcher: Pattern[str]
_long_break_matcher: Pattern[str]
class _Section:
formatter: HelpFormatter
heading: str | None
parent: Self | None
items: list[tuple[Callable[..., str], Iterable[Any]]]
def __init__(self, formatter: HelpFormatter, parent: Self | None, heading: str | None = None) -> None: ...
def format_help(self) -> str: ...
if sys.version_info >= (3, 15):
def __init__(
self, prog: str, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None
) -> None: ...
elif sys.version_info >= (3, 14):
def __init__(
self, prog: str, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None, color: bool = True
) -> None: ...
else:
def __init__(
self, prog: str, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None
) -> None: ...
def _indent(self) -> None: ...
def _dedent(self) -> None: ...
def _add_item(self, func: Callable[..., str], args: Iterable[Any]) -> None: ...
def start_section(self, heading: str | None) -> None: ...
def end_section(self) -> None: ...
def add_text(self, text: str | None) -> None: ...
def add_usage(
self, usage: str | None, actions: Iterable[Action], groups: Iterable[_MutuallyExclusiveGroup], prefix: str | None = None
) -> None: ...
def add_argument(self, action: Action) -> None: ...
def add_arguments(self, actions: Iterable[Action]) -> None: ...
def format_help(self) -> str: ...
def _join_parts(self, part_strings: Iterable[str]) -> str: ...
def _format_usage(
self, usage: str | None, actions: Iterable[Action], groups: Iterable[_MutuallyExclusiveGroup], prefix: str | None
) -> str: ...
if sys.version_info < (3, 14):
# Removed in Python 3.14.3
def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_MutuallyExclusiveGroup]) -> str: ...
def _format_text(self, text: str) -> str: ...
def _format_action(self, action: Action) -> str: ...
def _format_action_invocation(self, action: Action) -> str: ...
def _metavar_formatter(self, action: Action, default_metavar: str) -> Callable[[int], tuple[str, ...]]: ...
def _format_args(self, action: Action, default_metavar: str) -> str: ...
def _expand_help(self, action: Action) -> str: ...
def _iter_indented_subactions(self, action: Action) -> Generator[Action]: ...
def _split_lines(self, text: str, width: int) -> list[str]: ...
def _fill_text(self, text: str, width: int, indent: str) -> str: ...
def _get_help_string(self, action: Action) -> str | None: ...
def _get_default_metavar_for_optional(self, action: Action) -> str: ...
def _get_default_metavar_for_positional(self, action: Action) -> str: ...
class RawDescriptionHelpFormatter(HelpFormatter): ...
class RawTextHelpFormatter(RawDescriptionHelpFormatter): ...
class ArgumentDefaultsHelpFormatter(HelpFormatter): ...
class MetavarTypeHelpFormatter(HelpFormatter): ...
class Action(_AttributeHolder):
option_strings: Sequence[str]
dest: str
nargs: int | str | None
const: Any
default: Any
type: _ActionType | None
choices: Iterable[Any] | None
required: bool
help: str | None
metavar: str | tuple[str, ...] | None
if sys.version_info >= (3, 13):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
nargs: int | str | None = None,
const: _T | None = None,
default: _T | str | None = None,
type: Callable[[str], _T] | FileType | None = None,
choices: Iterable[_T] | None = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
deprecated: bool = False,
) -> None: ...
else:
def __init__(
self,
option_strings: Sequence[str],
dest: str,
nargs: int | str | None = None,
const: _T | None = None,
default: _T | str | None = None,
type: Callable[[str], _T] | FileType | None = None,
choices: Iterable[_T] | None = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
) -> None: ...
def __call__(
self, parser: ArgumentParser, namespace: Namespace, values: str | Sequence[Any] | None, option_string: str | None = None
) -> None: ...
def format_usage(self) -> str: ...
if sys.version_info >= (3, 12):
class BooleanOptionalAction(Action):
if sys.version_info >= (3, 14):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: bool | None = None,
required: bool = False,
help: str | None = None,
deprecated: bool = False,
) -> None: ...
elif sys.version_info >= (3, 13):
@overload
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: bool | None = None,
*,
required: bool = False,
help: str | None = None,
deprecated: bool = False,
) -> None: ...
@overload
@deprecated("The `type`, `choices`, and `metavar` parameters are ignored and will be removed in Python 3.14.")
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: _T | bool | None = None,
type: Callable[[str], _T] | FileType | None = sentinel,
choices: Iterable[_T] | None = sentinel,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = sentinel,
deprecated: bool = False,
) -> None: ...
else:
@overload
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: bool | None = None,
*,
required: bool = False,
help: str | None = None,
) -> None: ...
@overload
@deprecated("The `type`, `choices`, and `metavar` parameters are ignored and will be removed in Python 3.14.")
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: _T | bool | None = None,
type: Callable[[str], _T] | FileType | None = sentinel,
choices: Iterable[_T] | None = sentinel,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = sentinel,
) -> None: ...
else:
class BooleanOptionalAction(Action):
@overload
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: bool | None = None,
*,
required: bool = False,
help: str | None = None,
) -> None: ...
@overload
@deprecated("The `type`, `choices`, and `metavar` parameters are ignored and will be removed in Python 3.14.")
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: _T | bool | None = None,
type: Callable[[str], _T] | FileType | None = None,
choices: Iterable[_T] | None = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
) -> None: ...
class Namespace(_AttributeHolder):
def __init__(self, **kwargs: Any) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any, /) -> None: ...
def __contains__(self, key: str) -> bool: ...
def __eq__(self, other: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
@deprecated("Deprecated since Python 3.14. Open files after parsing arguments instead.")
class FileType:
# undocumented
_mode: str
_bufsize: int
_encoding: str | None
_errors: str | None
def __init__(self, mode: str = "r", bufsize: int = -1, encoding: str | None = None, errors: str | None = None) -> None: ...
def __call__(self, string: str) -> IO[Any]: ...
# undocumented
class _ArgumentGroup(_ActionsContainer):
title: str | None
_group_actions: list[Action]
@overload
def __init__(
self,
container: _ActionsContainer,
title: str | None = None,
description: str | None = None,
*,
argument_default: Any = ...,
conflict_handler: str = ...,
) -> None: ...
@overload
@deprecated("Undocumented `prefix_chars` parameter is deprecated since Python 3.14.")
def __init__(
self,
container: _ActionsContainer,
title: str | None = None,
description: str | None = None,
*,
prefix_chars: str,
argument_default: Any = ...,
conflict_handler: str = ...,
) -> None: ...
# undocumented
class _MutuallyExclusiveGroup(_ArgumentGroup):
required: bool
_container: _ActionsContainer
def __init__(self, container: _ActionsContainer, required: bool = False) -> None: ...
# undocumented
class _StoreAction(Action): ...
# undocumented
class _StoreConstAction(Action):
if sys.version_info >= (3, 13):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
const: Any | None = None,
default: Any = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
deprecated: bool = False,
) -> None: ...
elif sys.version_info >= (3, 11):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
const: Any | None = None,
default: Any = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
) -> None: ...
else:
def __init__(
self,
option_strings: Sequence[str],
dest: str,
const: Any,
default: Any = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
) -> None: ...
# undocumented
class _StoreTrueAction(_StoreConstAction):
if sys.version_info >= (3, 13):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: bool = False,
required: bool = False,
help: str | None = None,
deprecated: bool = False,
) -> None: ...
else:
def __init__(
self, option_strings: Sequence[str], dest: str, default: bool = False, required: bool = False, help: str | None = None
) -> None: ...
# undocumented
class _StoreFalseAction(_StoreConstAction):
if sys.version_info >= (3, 13):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: bool = True,
required: bool = False,
help: str | None = None,
deprecated: bool = False,
) -> None: ...
else:
def __init__(
self, option_strings: Sequence[str], dest: str, default: bool = True, required: bool = False, help: str | None = None
) -> None: ...
# undocumented
class _AppendAction(Action): ...
# undocumented
class _ExtendAction(_AppendAction): ...
# undocumented
class _AppendConstAction(Action):
if sys.version_info >= (3, 13):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
const: Any | None = None,
default: Any = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
deprecated: bool = False,
) -> None: ...
elif sys.version_info >= (3, 11):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
const: Any | None = None,
default: Any = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
) -> None: ...
else:
def __init__(
self,
option_strings: Sequence[str],
dest: str,
const: Any,
default: Any = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
) -> None: ...
# undocumented
class _CountAction(Action):
if sys.version_info >= (3, 13):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: Any = None,
required: bool = False,
help: str | None = None,
deprecated: bool = False,
) -> None: ...
else:
def __init__(
self, option_strings: Sequence[str], dest: str, default: Any = None, required: bool = False, help: str | None = None
) -> None: ...
# undocumented
class _HelpAction(Action):
if sys.version_info >= (3, 13):
def __init__(
self,
option_strings: Sequence[str],
dest: str = "==SUPPRESS==",
default: str = "==SUPPRESS==",
help: str | None = None,
deprecated: bool = False,
) -> None: ...
else:
def __init__(
self,
option_strings: Sequence[str],
dest: str = "==SUPPRESS==",
default: str = "==SUPPRESS==",
help: str | None = None,
) -> None: ...
# undocumented
class _VersionAction(Action):
version: str | None
if sys.version_info >= (3, 13):
def __init__(
self,
option_strings: Sequence[str],
version: str | None = None,
dest: str = "==SUPPRESS==",
default: str = "==SUPPRESS==",
help: str | None = None,
deprecated: bool = False,
) -> None: ...
elif sys.version_info >= (3, 11):
def __init__(
self,
option_strings: Sequence[str],
version: str | None = None,
dest: str = "==SUPPRESS==",
default: str = "==SUPPRESS==",
help: str | None = None,
) -> None: ...
else:
def __init__(
self,
option_strings: Sequence[str],
version: str | None = None,
dest: str = "==SUPPRESS==",
default: str = "==SUPPRESS==",
help: str = "show program's version number and exit",
) -> None: ...
# undocumented
class _SubParsersAction(Action, Generic[_ArgumentParserT]):
_ChoicesPseudoAction: type[Any] # nested class
_prog_prefix: str
_parser_class: type[_ArgumentParserT]
_name_parser_map: dict[str, _ArgumentParserT]
choices: dict[str, _ArgumentParserT]
_choices_actions: list[Action]
def __init__(
self,
option_strings: Sequence[str],
prog: str,
parser_class: type[_ArgumentParserT],
dest: str = "==SUPPRESS==",
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
) -> None: ...
# Note: `add_parser` accepts all kwargs of `ArgumentParser.__init__`. It also
# accepts its own `help` and `aliases` kwargs.
if sys.version_info >= (3, 14):
def add_parser(
self,
name: str,
*,
deprecated: bool = False,
help: str | None = ...,
aliases: Iterable[str] = ...,
# Kwargs from ArgumentParser constructor
prog: str | None = ...,
usage: str | None = ...,
description: str | None = ...,
epilog: str | None = ...,
parents: Iterable[_ArgumentParserT] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = True,
allow_abbrev: bool = True,
exit_on_error: bool = True,
suggest_on_error: bool = False,
color: bool = False,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes
) -> _ArgumentParserT: ...
elif sys.version_info >= (3, 13):
def add_parser(
self,
name: str,
*,
deprecated: bool = False,
help: str | None = ...,
aliases: Iterable[str] = ...,
# Kwargs from ArgumentParser constructor
prog: str | None = ...,
usage: str | None = ...,
description: str | None = ...,
epilog: str | None = ...,
parents: Iterable[_ArgumentParserT] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = True,
allow_abbrev: bool = True,
exit_on_error: bool = True,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes
) -> _ArgumentParserT: ...
else:
def add_parser(
self,
name: str,
*,
help: str | None = ...,
aliases: Iterable[str] = ...,
# Kwargs from ArgumentParser constructor
prog: str | None = ...,
usage: str | None = ...,
description: str | None = ...,
epilog: str | None = ...,
parents: Iterable[_ArgumentParserT] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = True,
allow_abbrev: bool = True,
exit_on_error: bool = True,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes
) -> _ArgumentParserT: ...
def _get_subactions(self) -> list[Action]: ...
# undocumented
class ArgumentTypeError(Exception): ...
# undocumented
def _get_action_name(argument: Action | None) -> str | None: ...
@@ -1,124 +0,0 @@
import sys
from _typeshed import ReadableBuffer, SupportsNoArgReadline, SupportsRead, SupportsWrite
__all__ = [
"encode",
"decode",
"encodebytes",
"decodebytes",
"b64encode",
"b64decode",
"b32encode",
"b32decode",
"b16encode",
"b16decode",
"b32hexencode",
"b32hexdecode",
"b85encode",
"b85decode",
"a85encode",
"a85decode",
"standard_b64encode",
"standard_b64decode",
"urlsafe_b64encode",
"urlsafe_b64decode",
]
if sys.version_info >= (3, 13):
__all__ += ["z85decode", "z85encode"]
if sys.version_info >= (3, 15):
def b64encode(
s: ReadableBuffer, altchars: ReadableBuffer | None = None, *, padded: bool = True, wrapcol: int = 0
) -> bytes: ...
def b64decode(
s: str | ReadableBuffer,
altchars: str | ReadableBuffer | None = None,
validate: bool = ...,
*,
padded: bool = True,
ignorechars: ReadableBuffer = ...,
canonical: bool = False,
) -> bytes: ...
else:
def b64encode(s: ReadableBuffer, altchars: ReadableBuffer | None = None) -> bytes: ...
def b64decode(s: str | ReadableBuffer, altchars: str | ReadableBuffer | None = None, validate: bool = False) -> bytes: ...
def standard_b64encode(s: ReadableBuffer) -> bytes: ...
def standard_b64decode(s: str | ReadableBuffer) -> bytes: ...
if sys.version_info >= (3, 15):
def urlsafe_b64encode(s: ReadableBuffer, *, padded: bool = True) -> bytes: ...
def urlsafe_b64decode(s: str | ReadableBuffer, *, padded: bool = False) -> bytes: ...
def b32encode(s: ReadableBuffer, *, padded: bool = True, wrapcol: int = 0) -> bytes: ...
def b32decode(
s: str | ReadableBuffer,
casefold: bool = False,
map01: str | ReadableBuffer | None = None,
*,
padded: bool = True,
ignorechars: ReadableBuffer = b"",
canonical: bool = False,
) -> bytes: ...
def b16encode(s: ReadableBuffer, *, wrapcol: int = 0) -> bytes: ...
def b16decode(s: str | ReadableBuffer, casefold: bool = False, *, ignorechars: ReadableBuffer = b"") -> bytes: ...
else:
def urlsafe_b64encode(s: ReadableBuffer) -> bytes: ...
def urlsafe_b64decode(s: str | ReadableBuffer) -> bytes: ...
def b32encode(s: ReadableBuffer) -> bytes: ...
def b32decode(s: str | ReadableBuffer, casefold: bool = False, map01: str | ReadableBuffer | None = None) -> bytes: ...
def b16encode(s: ReadableBuffer) -> bytes: ...
def b16decode(s: str | ReadableBuffer, casefold: bool = False) -> bytes: ...
if sys.version_info >= (3, 15):
def b32hexencode(s: ReadableBuffer, *, padded: bool = True, wrapcol: int = 0) -> bytes: ...
def b32hexdecode(
s: str | ReadableBuffer,
casefold: bool = False,
*,
padded: bool = True,
ignorechars: ReadableBuffer = b"",
canonical: bool = False,
) -> bytes: ...
else:
def b32hexencode(s: ReadableBuffer) -> bytes: ...
def b32hexdecode(s: str | ReadableBuffer, casefold: bool = False) -> bytes: ...
def a85encode(
b: ReadableBuffer, *, foldspaces: bool = False, wrapcol: int = 0, pad: bool = False, adobe: bool = False
) -> bytes: ...
if sys.version_info >= (3, 15):
def a85decode(
b: str | ReadableBuffer,
*,
foldspaces: bool = False,
adobe: bool = False,
ignorechars: bytearray | bytes = b" \t\n\r\x0b",
canonical: bool = False,
) -> bytes: ...
def b85encode(b: ReadableBuffer, pad: bool = False, *, wrapcol: int = 0) -> bytes: ...
def b85decode(b: str | ReadableBuffer, *, ignorechars: ReadableBuffer = b"", canonical: bool = False) -> bytes: ...
else:
def a85decode(
b: str | ReadableBuffer, *, foldspaces: bool = False, adobe: bool = False, ignorechars: bytearray | bytes = b" \t\n\r\x0b"
) -> bytes: ...
def b85encode(b: ReadableBuffer, pad: bool = False) -> bytes: ...
def b85decode(b: str | ReadableBuffer) -> bytes: ...
def decode(input: SupportsNoArgReadline[bytes], output: SupportsWrite[bytes]) -> None: ...
def encode(input: SupportsRead[bytes], output: SupportsWrite[bytes]) -> None: ...
def encodebytes(s: ReadableBuffer) -> bytes: ...
def decodebytes(s: ReadableBuffer) -> bytes: ...
if sys.version_info >= (3, 13):
if sys.version_info >= (3, 15):
def z85encode(s: ReadableBuffer, pad: bool = False, *, wrapcol: int = 0) -> bytes: ...
def z85decode(s: str | ReadableBuffer, *, ignorechars: ReadableBuffer = b"", canonical: bool = False) -> bytes: ...
else:
def z85encode(s: ReadableBuffer) -> bytes: ...
def z85decode(s: str | ReadableBuffer) -> bytes: ...
@@ -1,102 +0,0 @@
import sys
from _typeshed import ReadableBuffer
from typing import TypeAlias
from typing_extensions import deprecated
# Many functions in binascii accept buffer objects
# or ASCII-only strings.
_AsciiBuffer: TypeAlias = str | ReadableBuffer
def a2b_uu(data: _AsciiBuffer, /) -> bytes: ...
def b2a_uu(data: ReadableBuffer, /, *, backtick: bool = False) -> bytes: ...
if sys.version_info >= (3, 15):
ASCII85_ALPHABET: bytes
BINHEX_ALPHABET: bytes
CRYPT_ALPHABET: bytes
UU_ALPHABET: bytes
BASE64_ALPHABET: bytes
URLSAFE_BASE64_ALPHABET: bytes
BASE32_ALPHABET: bytes
BASE32HEX_ALPHABET: bytes
BASE85_ALPHABET: bytes
Z85_ALPHABET: bytes
def a2b_base64(
data: _AsciiBuffer,
/,
*,
strict_mode: bool = False,
alphabet: bytes = ...,
padded: bool = True,
ignorechars: ReadableBuffer = ...,
canonical: bool = False,
) -> bytes: ...
def b2a_base64(
data: ReadableBuffer, /, *, newline: bool = True, alphabet: ReadableBuffer = ..., padded: bool = True, wrapcol: int = 0
) -> bytes: ...
def b2a_base32(
data: ReadableBuffer, /, *, alphabet: ReadableBuffer = ..., padded: bool = True, wrapcol: int = 0
) -> bytes: ...
def a2b_base32(
data: _AsciiBuffer,
/,
*,
alphabet: bytes = ...,
padded: bool = True,
ignorechars: ReadableBuffer = b"",
canonical: bool = False,
) -> bytes: ...
def b2a_ascii85(
data: ReadableBuffer, /, *, foldspaces: bool = False, wrapcol: int = 0, pad: bool = False, adobe: bool = False
) -> bytes: ...
def a2b_ascii85(
data: _AsciiBuffer,
/,
*,
foldspaces: bool = False,
adobe: bool = False,
ignorechars: ReadableBuffer = b"",
canonical: bool = False,
) -> bytes: ...
def b2a_base85(data: ReadableBuffer, /, *, alphabet: ReadableBuffer = ..., pad: bool = False, wrapcol: int = 0) -> bytes: ...
def a2b_base85(
data: _AsciiBuffer, /, *, alphabet: bytes = ..., ignorechars: ReadableBuffer = b"", canonical: bool = False
) -> bytes: ...
elif sys.version_info >= (3, 11):
def a2b_base64(data: _AsciiBuffer, /, *, strict_mode: bool = False) -> bytes: ...
else:
def a2b_base64(data: _AsciiBuffer, /) -> bytes: ...
if sys.version_info < (3, 15):
def b2a_base64(data: ReadableBuffer, /, *, newline: bool = True) -> bytes: ...
def a2b_qp(data: _AsciiBuffer, header: bool = False) -> bytes: ...
def b2a_qp(data: ReadableBuffer, quotetabs: bool = False, istext: bool = True, header: bool = False) -> bytes: ...
if sys.version_info < (3, 11):
@deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
def a2b_hqx(data: _AsciiBuffer, /) -> bytes: ...
@deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
def rledecode_hqx(data: ReadableBuffer, /) -> bytes: ...
@deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
def rlecode_hqx(data: ReadableBuffer, /) -> bytes: ...
@deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
def b2a_hqx(data: ReadableBuffer, /) -> bytes: ...
def crc_hqx(data: ReadableBuffer, crc: int, /) -> int: ...
def crc32(data: ReadableBuffer, crc: int = 0, /) -> int: ...
def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = 1) -> bytes: ...
def hexlify(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = 1) -> bytes: ...
if sys.version_info >= (3, 15):
def a2b_hex(hexstr: _AsciiBuffer, /, *, ignorechars: ReadableBuffer = b"") -> bytes: ...
def unhexlify(hexstr: _AsciiBuffer, /, *, ignorechars: ReadableBuffer = b"") -> bytes: ...
else:
def a2b_hex(hexstr: _AsciiBuffer, /) -> bytes: ...
def unhexlify(hexstr: _AsciiBuffer, /) -> bytes: ...
class Error(ValueError): ...
class Incomplete(Exception): ...
@@ -1,427 +0,0 @@
import sys
if sys.platform != "win32":
# Actually defined here, but defining in os allows sharing code with windows
from os import (
CLD_CONTINUED as CLD_CONTINUED,
CLD_DUMPED as CLD_DUMPED,
CLD_EXITED as CLD_EXITED,
CLD_KILLED as CLD_KILLED,
CLD_STOPPED as CLD_STOPPED,
CLD_TRAPPED as CLD_TRAPPED,
EX_CANTCREAT as EX_CANTCREAT,
EX_CONFIG as EX_CONFIG,
EX_DATAERR as EX_DATAERR,
EX_IOERR as EX_IOERR,
EX_NOHOST as EX_NOHOST,
EX_NOINPUT as EX_NOINPUT,
EX_NOPERM as EX_NOPERM,
EX_NOUSER as EX_NOUSER,
EX_OK as EX_OK,
EX_OSERR as EX_OSERR,
EX_OSFILE as EX_OSFILE,
EX_PROTOCOL as EX_PROTOCOL,
EX_SOFTWARE as EX_SOFTWARE,
EX_TEMPFAIL as EX_TEMPFAIL,
EX_UNAVAILABLE as EX_UNAVAILABLE,
EX_USAGE as EX_USAGE,
F_LOCK as F_LOCK,
F_OK as F_OK,
F_TEST as F_TEST,
F_TLOCK as F_TLOCK,
F_ULOCK as F_ULOCK,
NGROUPS_MAX as NGROUPS_MAX,
O_ACCMODE as O_ACCMODE,
O_APPEND as O_APPEND,
O_ASYNC as O_ASYNC,
O_CLOEXEC as O_CLOEXEC,
O_CREAT as O_CREAT,
O_DIRECTORY as O_DIRECTORY,
O_DSYNC as O_DSYNC,
O_EXCL as O_EXCL,
O_FSYNC as O_FSYNC,
O_NDELAY as O_NDELAY,
O_NOCTTY as O_NOCTTY,
O_NOFOLLOW as O_NOFOLLOW,
O_NONBLOCK as O_NONBLOCK,
O_RDONLY as O_RDONLY,
O_RDWR as O_RDWR,
O_SYNC as O_SYNC,
O_TRUNC as O_TRUNC,
O_WRONLY as O_WRONLY,
P_ALL as P_ALL,
P_PGID as P_PGID,
P_PID as P_PID,
POSIX_SPAWN_CLOSE as POSIX_SPAWN_CLOSE,
POSIX_SPAWN_DUP2 as POSIX_SPAWN_DUP2,
POSIX_SPAWN_OPEN as POSIX_SPAWN_OPEN,
PRIO_PGRP as PRIO_PGRP,
PRIO_PROCESS as PRIO_PROCESS,
PRIO_USER as PRIO_USER,
R_OK as R_OK,
RTLD_GLOBAL as RTLD_GLOBAL,
RTLD_LAZY as RTLD_LAZY,
RTLD_LOCAL as RTLD_LOCAL,
RTLD_NODELETE as RTLD_NODELETE,
RTLD_NOLOAD as RTLD_NOLOAD,
RTLD_NOW as RTLD_NOW,
SCHED_FIFO as SCHED_FIFO,
SCHED_OTHER as SCHED_OTHER,
SCHED_RR as SCHED_RR,
SEEK_DATA as SEEK_DATA,
SEEK_HOLE as SEEK_HOLE,
ST_NOSUID as ST_NOSUID,
ST_RDONLY as ST_RDONLY,
TMP_MAX as TMP_MAX,
W_OK as W_OK,
WCONTINUED as WCONTINUED,
WCOREDUMP as WCOREDUMP,
WEXITED as WEXITED,
WEXITSTATUS as WEXITSTATUS,
WIFCONTINUED as WIFCONTINUED,
WIFEXITED as WIFEXITED,
WIFSIGNALED as WIFSIGNALED,
WIFSTOPPED as WIFSTOPPED,
WNOHANG as WNOHANG,
WNOWAIT as WNOWAIT,
WSTOPPED as WSTOPPED,
WSTOPSIG as WSTOPSIG,
WTERMSIG as WTERMSIG,
WUNTRACED as WUNTRACED,
X_OK as X_OK,
DirEntry as DirEntry,
_exit as _exit,
abort as abort,
access as access,
chdir as chdir,
chmod as chmod,
chown as chown,
chroot as chroot,
close as close,
closerange as closerange,
confstr as confstr,
confstr_names as confstr_names,
cpu_count as cpu_count,
ctermid as ctermid,
device_encoding as device_encoding,
dup as dup,
dup2 as dup2,
error as error,
execv as execv,
execve as execve,
fchdir as fchdir,
fchmod as fchmod,
fchown as fchown,
fork as fork,
forkpty as forkpty,
fpathconf as fpathconf,
fspath as fspath,
fstat as fstat,
fstatvfs as fstatvfs,
fsync as fsync,
ftruncate as ftruncate,
get_blocking as get_blocking,
get_inheritable as get_inheritable,
get_terminal_size as get_terminal_size,
getcwd as getcwd,
getcwdb as getcwdb,
getegid as getegid,
geteuid as geteuid,
getgid as getgid,
getgrouplist as getgrouplist,
getgroups as getgroups,
getloadavg as getloadavg,
getlogin as getlogin,
getpgid as getpgid,
getpgrp as getpgrp,
getpid as getpid,
getppid as getppid,
getpriority as getpriority,
getsid as getsid,
getuid as getuid,
initgroups as initgroups,
isatty as isatty,
kill as kill,
killpg as killpg,
lchown as lchown,
link as link,
listdir as listdir,
lockf as lockf,
lseek as lseek,
lstat as lstat,
major as major,
makedev as makedev,
minor as minor,
mkdir as mkdir,
mkfifo as mkfifo,
mknod as mknod,
nice as nice,
open as open,
openpty as openpty,
pathconf as pathconf,
pathconf_names as pathconf_names,
pipe as pipe,
posix_spawn as posix_spawn,
posix_spawnp as posix_spawnp,
pread as pread,
preadv as preadv,
putenv as putenv,
pwrite as pwrite,
pwritev as pwritev,
read as read,
readlink as readlink,
readv as readv,
register_at_fork as register_at_fork,
remove as remove,
rename as rename,
replace as replace,
rmdir as rmdir,
scandir as scandir,
sched_get_priority_max as sched_get_priority_max,
sched_get_priority_min as sched_get_priority_min,
sched_param as sched_param,
sched_yield as sched_yield,
sendfile as sendfile,
set_blocking as set_blocking,
set_inheritable as set_inheritable,
setegid as setegid,
seteuid as seteuid,
setgid as setgid,
setgroups as setgroups,
setpgid as setpgid,
setpgrp as setpgrp,
setpriority as setpriority,
setregid as setregid,
setreuid as setreuid,
setsid as setsid,
setuid as setuid,
stat as stat,
stat_result as stat_result,
statvfs as statvfs,
statvfs_result as statvfs_result,
strerror as strerror,
symlink as symlink,
sync as sync,
sysconf as sysconf,
sysconf_names as sysconf_names,
system as system,
tcgetpgrp as tcgetpgrp,
tcsetpgrp as tcsetpgrp,
terminal_size as terminal_size,
times as times,
times_result as times_result,
truncate as truncate,
ttyname as ttyname,
umask as umask,
uname as uname,
uname_result as uname_result,
unlink as unlink,
unsetenv as unsetenv,
urandom as urandom,
utime as utime,
wait as wait,
wait3 as wait3,
wait4 as wait4,
waitpid as waitpid,
waitstatus_to_exitcode as waitstatus_to_exitcode,
write as write,
writev as writev,
)
if sys.version_info >= (3, 11):
from os import login_tty as login_tty
if sys.version_info >= (3, 13):
from os import grantpt as grantpt, posix_openpt as posix_openpt, ptsname as ptsname, unlockpt as unlockpt
if sys.version_info >= (3, 13) and sys.platform == "linux":
from os import (
POSIX_SPAWN_CLOSEFROM as POSIX_SPAWN_CLOSEFROM,
TFD_CLOEXEC as TFD_CLOEXEC,
TFD_NONBLOCK as TFD_NONBLOCK,
TFD_TIMER_ABSTIME as TFD_TIMER_ABSTIME,
TFD_TIMER_CANCEL_ON_SET as TFD_TIMER_CANCEL_ON_SET,
timerfd_create as timerfd_create,
timerfd_gettime as timerfd_gettime,
timerfd_gettime_ns as timerfd_gettime_ns,
timerfd_settime as timerfd_settime,
timerfd_settime_ns as timerfd_settime_ns,
)
if sys.version_info >= (3, 14):
from os import readinto as readinto
if sys.version_info >= (3, 14) and sys.platform == "linux":
from os import SCHED_DEADLINE as SCHED_DEADLINE, SCHED_NORMAL as SCHED_NORMAL
if sys.platform != "linux":
from os import O_EXLOCK as O_EXLOCK, O_SHLOCK as O_SHLOCK, chflags as chflags, lchflags as lchflags, lchmod as lchmod
if sys.platform != "linux" and sys.platform != "darwin":
from os import EX_NOTFOUND as EX_NOTFOUND, SCHED_SPORADIC as SCHED_SPORADIC
if sys.platform != "linux" and sys.version_info >= (3, 13):
from os import O_EXEC as O_EXEC, O_SEARCH as O_SEARCH
if sys.version_info >= (3, 15):
from os import NODEV as NODEV
if sys.version_info >= (3, 15) and sys.platform == "linux":
from os import (
AT_NO_AUTOMOUNT as AT_NO_AUTOMOUNT,
AT_STATX_DONT_SYNC as AT_STATX_DONT_SYNC,
AT_STATX_FORCE_SYNC as AT_STATX_FORCE_SYNC,
AT_STATX_SYNC_AS_STAT as AT_STATX_SYNC_AS_STAT,
STATX_ATIME as STATX_ATIME,
STATX_BASIC_STATS as STATX_BASIC_STATS,
STATX_BLOCKS as STATX_BLOCKS,
STATX_BTIME as STATX_BTIME,
STATX_CTIME as STATX_CTIME,
STATX_DIOALIGN as STATX_DIOALIGN,
STATX_GID as STATX_GID,
STATX_INO as STATX_INO,
STATX_MNT_ID as STATX_MNT_ID,
STATX_MNT_ID_UNIQUE as STATX_MNT_ID_UNIQUE,
STATX_MODE as STATX_MODE,
STATX_MTIME as STATX_MTIME,
STATX_NLINK as STATX_NLINK,
STATX_SIZE as STATX_SIZE,
STATX_TYPE as STATX_TYPE,
STATX_UID as STATX_UID,
_clearenv as _clearenv,
statx as statx,
statx_result as statx_result,
)
if sys.platform != "darwin":
from os import (
POSIX_FADV_DONTNEED as POSIX_FADV_DONTNEED,
POSIX_FADV_NOREUSE as POSIX_FADV_NOREUSE,
POSIX_FADV_NORMAL as POSIX_FADV_NORMAL,
POSIX_FADV_RANDOM as POSIX_FADV_RANDOM,
POSIX_FADV_SEQUENTIAL as POSIX_FADV_SEQUENTIAL,
POSIX_FADV_WILLNEED as POSIX_FADV_WILLNEED,
RWF_APPEND as RWF_APPEND,
RWF_DSYNC as RWF_DSYNC,
RWF_HIPRI as RWF_HIPRI,
RWF_NOWAIT as RWF_NOWAIT,
RWF_SYNC as RWF_SYNC,
ST_APPEND as ST_APPEND,
ST_MANDLOCK as ST_MANDLOCK,
ST_NOATIME as ST_NOATIME,
ST_NODEV as ST_NODEV,
ST_NODIRATIME as ST_NODIRATIME,
ST_NOEXEC as ST_NOEXEC,
ST_RELATIME as ST_RELATIME,
ST_SYNCHRONOUS as ST_SYNCHRONOUS,
ST_WRITE as ST_WRITE,
fdatasync as fdatasync,
getresgid as getresgid,
getresuid as getresuid,
pipe2 as pipe2,
posix_fadvise as posix_fadvise,
posix_fallocate as posix_fallocate,
sched_getaffinity as sched_getaffinity,
sched_getparam as sched_getparam,
sched_getscheduler as sched_getscheduler,
sched_rr_get_interval as sched_rr_get_interval,
sched_setaffinity as sched_setaffinity,
sched_setparam as sched_setparam,
sched_setscheduler as sched_setscheduler,
setresgid as setresgid,
setresuid as setresuid,
)
if sys.platform != "darwin" or sys.version_info >= (3, 13):
from os import waitid as waitid, waitid_result as waitid_result
if sys.platform == "linux":
from os import (
EFD_CLOEXEC as EFD_CLOEXEC,
EFD_NONBLOCK as EFD_NONBLOCK,
EFD_SEMAPHORE as EFD_SEMAPHORE,
GRND_NONBLOCK as GRND_NONBLOCK,
GRND_RANDOM as GRND_RANDOM,
MFD_ALLOW_SEALING as MFD_ALLOW_SEALING,
MFD_CLOEXEC as MFD_CLOEXEC,
MFD_HUGE_1GB as MFD_HUGE_1GB,
MFD_HUGE_1MB as MFD_HUGE_1MB,
MFD_HUGE_2GB as MFD_HUGE_2GB,
MFD_HUGE_2MB as MFD_HUGE_2MB,
MFD_HUGE_8MB as MFD_HUGE_8MB,
MFD_HUGE_16GB as MFD_HUGE_16GB,
MFD_HUGE_16MB as MFD_HUGE_16MB,
MFD_HUGE_32MB as MFD_HUGE_32MB,
MFD_HUGE_64KB as MFD_HUGE_64KB,
MFD_HUGE_256MB as MFD_HUGE_256MB,
MFD_HUGE_512KB as MFD_HUGE_512KB,
MFD_HUGE_512MB as MFD_HUGE_512MB,
MFD_HUGE_MASK as MFD_HUGE_MASK,
MFD_HUGE_SHIFT as MFD_HUGE_SHIFT,
MFD_HUGETLB as MFD_HUGETLB,
O_DIRECT as O_DIRECT,
O_LARGEFILE as O_LARGEFILE,
O_NOATIME as O_NOATIME,
O_PATH as O_PATH,
O_RSYNC as O_RSYNC,
O_TMPFILE as O_TMPFILE,
P_PIDFD as P_PIDFD,
RTLD_DEEPBIND as RTLD_DEEPBIND,
SCHED_BATCH as SCHED_BATCH,
SCHED_IDLE as SCHED_IDLE,
SCHED_RESET_ON_FORK as SCHED_RESET_ON_FORK,
SPLICE_F_MORE as SPLICE_F_MORE,
SPLICE_F_MOVE as SPLICE_F_MOVE,
SPLICE_F_NONBLOCK as SPLICE_F_NONBLOCK,
XATTR_CREATE as XATTR_CREATE,
XATTR_REPLACE as XATTR_REPLACE,
XATTR_SIZE_MAX as XATTR_SIZE_MAX,
copy_file_range as copy_file_range,
eventfd as eventfd,
eventfd_read as eventfd_read,
eventfd_write as eventfd_write,
getrandom as getrandom,
getxattr as getxattr,
listxattr as listxattr,
memfd_create as memfd_create,
pidfd_open as pidfd_open,
removexattr as removexattr,
setxattr as setxattr,
splice as splice,
)
if sys.version_info >= (3, 12):
from os import (
CLONE_FILES as CLONE_FILES,
CLONE_FS as CLONE_FS,
CLONE_NEWCGROUP as CLONE_NEWCGROUP,
CLONE_NEWIPC as CLONE_NEWIPC,
CLONE_NEWNET as CLONE_NEWNET,
CLONE_NEWNS as CLONE_NEWNS,
CLONE_NEWPID as CLONE_NEWPID,
CLONE_NEWTIME as CLONE_NEWTIME,
CLONE_NEWUSER as CLONE_NEWUSER,
CLONE_NEWUTS as CLONE_NEWUTS,
CLONE_SIGHAND as CLONE_SIGHAND,
CLONE_SYSVSEM as CLONE_SYSVSEM,
CLONE_THREAD as CLONE_THREAD,
CLONE_VM as CLONE_VM,
PIDFD_NONBLOCK as PIDFD_NONBLOCK,
setns as setns,
unshare as unshare,
)
if sys.platform == "darwin":
from os import O_EVTONLY as O_EVTONLY, O_NOFOLLOW_ANY as O_NOFOLLOW_ANY, O_SYMLINK as O_SYMLINK
if sys.version_info >= (3, 12):
from os import (
PRIO_DARWIN_BG as PRIO_DARWIN_BG,
PRIO_DARWIN_NONUI as PRIO_DARWIN_NONUI,
PRIO_DARWIN_PROCESS as PRIO_DARWIN_PROCESS,
PRIO_DARWIN_THREAD as PRIO_DARWIN_THREAD,
)
# Not same as os.environ or os.environb
# Because of this variable, we can't do "from posix import *" in os/__init__.pyi
environ: dict[bytes, bytes]
@@ -1,243 +0,0 @@
import os
import sys
from _typeshed import BytesPath, ExcInfo, FileDescriptorOrPath, MaybeNone, StrOrBytesPath, StrPath, SupportsRead, SupportsWrite
from collections.abc import Callable, Iterable, Sequence
from tarfile import _TarfileFilter
from typing import Any, AnyStr, NamedTuple, NoReturn, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import deprecated
__all__ = [
"copyfileobj",
"copyfile",
"copymode",
"copystat",
"copy",
"copy2",
"copytree",
"move",
"rmtree",
"Error",
"SpecialFileError",
"make_archive",
"get_archive_formats",
"register_archive_format",
"unregister_archive_format",
"get_unpack_formats",
"register_unpack_format",
"unregister_unpack_format",
"unpack_archive",
"ignore_patterns",
"chown",
"which",
"get_terminal_size",
"SameFileError",
"disk_usage",
]
if sys.version_info < (3, 14):
__all__ += ["ExecError"]
_StrOrBytesPathT = TypeVar("_StrOrBytesPathT", bound=StrOrBytesPath)
_StrPathT = TypeVar("_StrPathT", bound=StrPath)
_BytesPathT = TypeVar("_BytesPathT", bound=BytesPath)
class Error(OSError): ...
class SameFileError(Error): ...
class SpecialFileError(OSError): ...
if sys.version_info >= (3, 14):
ExecError = RuntimeError # Deprecated in Python 3.14; removal scheduled for Python 3.16
else:
class ExecError(OSError): ...
class ReadError(OSError): ...
class RegistryError(Exception): ...
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = 0) -> None: ...
def copyfile(src: StrOrBytesPath, dst: _StrOrBytesPathT, *, follow_symlinks: bool = True) -> _StrOrBytesPathT: ...
def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ...
def copystat(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ...
@overload
def copy(src: StrPath, dst: _StrPathT, *, follow_symlinks: bool = True) -> _StrPathT | str: ...
@overload
def copy(src: BytesPath, dst: _BytesPathT, *, follow_symlinks: bool = True) -> _BytesPathT | bytes: ...
@overload
def copy2(src: StrPath, dst: _StrPathT, *, follow_symlinks: bool = True) -> _StrPathT | str: ...
@overload
def copy2(src: BytesPath, dst: _BytesPathT, *, follow_symlinks: bool = True) -> _BytesPathT | bytes: ...
def ignore_patterns(*patterns: StrPath) -> Callable[[Any, list[str]], set[str]]: ...
def copytree(
src: StrPath,
dst: _StrPathT,
symlinks: bool = False,
ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = None,
copy_function: Callable[[str, str], object] = ...,
ignore_dangling_symlinks: bool = False,
dirs_exist_ok: bool = False,
) -> _StrPathT: ...
_OnErrorCallback: TypeAlias = Callable[[Callable[..., Any], str, ExcInfo], object]
_OnExcCallback: TypeAlias = Callable[[Callable[..., Any], str, BaseException], object]
@type_check_only
class _RmtreeType(Protocol):
avoids_symlink_attacks: bool
if sys.version_info >= (3, 12):
@overload
@deprecated("The `onerror` parameter is deprecated. Use `onexc` instead.")
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool,
onerror: _OnErrorCallback | None,
*,
onexc: None = None,
dir_fd: int | None = None,
) -> None: ...
@overload
@deprecated("The `onerror` parameter is deprecated. Use `onexc` instead.")
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = False,
*,
onerror: _OnErrorCallback | None,
onexc: None = None,
dir_fd: int | None = None,
) -> None: ...
@overload
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = False,
*,
onexc: _OnExcCallback | None = None,
dir_fd: int | None = None,
) -> None: ...
elif sys.version_info >= (3, 11):
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = False,
onerror: _OnErrorCallback | None = None,
*,
dir_fd: int | None = None,
) -> None: ...
else:
def __call__(
self, path: StrOrBytesPath, ignore_errors: bool = False, onerror: _OnErrorCallback | None = None
) -> None: ...
rmtree: _RmtreeType
_CopyFn: TypeAlias = Callable[[str, str], object] | Callable[[StrPath, StrPath], object]
# N.B. shutil.move appears to take bytes arguments, however,
# this does not work when dst is (or is within) an existing directory.
# (#6832)
def move(src: StrPath, dst: _StrPathT, copy_function: _CopyFn = ...) -> _StrPathT | str | MaybeNone: ...
class _ntuple_diskusage(NamedTuple):
total: int
used: int
free: int
def disk_usage(path: FileDescriptorOrPath) -> _ntuple_diskusage: ...
# While chown can be imported on Windows, it doesn't actually work;
# see https://bugs.python.org/issue33140. We keep it here because it's
# in __all__.
if sys.version_info >= (3, 13):
@overload
def chown(
path: FileDescriptorOrPath,
user: str | int,
group: None = None,
*,
dir_fd: int | None = None,
follow_symlinks: bool = True,
) -> None: ...
@overload
def chown(
path: FileDescriptorOrPath,
user: None = None,
*,
group: str | int,
dir_fd: int | None = None,
follow_symlinks: bool = True,
) -> None: ...
@overload
def chown(
path: FileDescriptorOrPath, user: None, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True
) -> None: ...
@overload
def chown(
path: FileDescriptorOrPath, user: str | int, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True
) -> None: ...
else:
@overload
def chown(path: FileDescriptorOrPath, user: str | int, group: None = None) -> None: ...
@overload
def chown(path: FileDescriptorOrPath, user: None = None, *, group: str | int) -> None: ...
@overload
def chown(path: FileDescriptorOrPath, user: None, group: str | int) -> None: ...
@overload
def chown(path: FileDescriptorOrPath, user: str | int, group: str | int) -> None: ...
if sys.platform == "win32" and sys.version_info < (3, 12):
@overload
@deprecated("On Windows before Python 3.12, using a PathLike as `cmd` would always fail or return `None`.")
def which(cmd: os.PathLike[str], mode: int = 1, path: StrPath | None = None) -> NoReturn: ...
@overload
def which(cmd: StrPath, mode: int = 1, path: StrPath | None = None) -> str | None: ...
@overload
def which(cmd: bytes, mode: int = 1, path: StrPath | None = None) -> bytes | None: ...
def make_archive(
base_name: str,
format: str,
root_dir: StrPath | None = None,
base_dir: StrPath | None = None,
verbose: bool = ...,
dry_run: bool = ...,
owner: str | None = None,
group: str | None = None,
logger: Any | None = None,
) -> str: ...
def get_archive_formats() -> list[tuple[str, str]]: ...
@overload
def register_archive_format(
name: str, function: Callable[..., object], extra_args: Sequence[tuple[str, Any] | list[Any]], description: str = ""
) -> None: ...
@overload
def register_archive_format(
name: str, function: Callable[[str, str], object], extra_args: None = None, description: str = ""
) -> None: ...
def unregister_archive_format(name: str) -> None: ...
def unpack_archive(
filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None, *, filter: _TarfileFilter | None = None
) -> None: ...
@overload
def register_unpack_format(
name: str,
extensions: list[str],
function: Callable[..., object],
extra_args: Sequence[tuple[str, Any]],
description: str = "",
) -> None: ...
@overload
def register_unpack_format(
name: str, extensions: list[str], function: Callable[[str, str], object], extra_args: None = None, description: str = ""
) -> None: ...
def unregister_unpack_format(name: str) -> None: ...
def get_unpack_formats() -> list[tuple[str, list[str], str]]: ...
def get_terminal_size(fallback: tuple[int, int] = (80, 24)) -> os.terminal_size: ...
File diff suppressed because it is too large. Load diff
@@ -1,81 +0,0 @@
import sys
from _typeshed import StrOrLiteralStr
from collections.abc import Iterable, Mapping, Sequence
from re import Pattern, RegexFlag
from typing import Any, ClassVar, Final, overload
from typing_extensions import LiteralString
__all__ = [
"ascii_letters",
"ascii_lowercase",
"ascii_uppercase",
"capwords",
"digits",
"hexdigits",
"octdigits",
"printable",
"punctuation",
"whitespace",
"Formatter",
"Template",
]
whitespace: Final = " \t\n\r\v\f"
ascii_lowercase: Final = "abcdefghijklmnopqrstuvwxyz"
ascii_uppercase: Final = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ascii_letters: Final[LiteralString] # string too long
digits: Final = "0123456789"
hexdigits: Final = "0123456789abcdefABCDEF"
octdigits: Final = "01234567"
punctuation: Final = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
printable: Final[LiteralString] # string too long
def capwords(s: StrOrLiteralStr, sep: StrOrLiteralStr | None = None) -> StrOrLiteralStr: ...
class Template:
template: str
delimiter: ClassVar[str]
idpattern: ClassVar[str]
braceidpattern: ClassVar[str | None]
if sys.version_info >= (3, 14):
flags: ClassVar[RegexFlag | None]
else:
flags: ClassVar[RegexFlag]
pattern: ClassVar[Pattern[str]]
def __init__(self, template: str) -> None: ...
def substitute(self, mapping: Mapping[str, object] = {}, /, **kwds: object) -> str: ...
def safe_substitute(self, mapping: Mapping[str, object] = {}, /, **kwds: object) -> str: ...
if sys.version_info >= (3, 11):
def get_identifiers(self) -> list[str]: ...
def is_valid(self) -> bool: ...
class Formatter:
@overload
def format(self, format_string: LiteralString, /, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
@overload
def format(self, format_string: str, /, *args: Any, **kwargs: Any) -> str: ...
@overload
def vformat(
self, format_string: LiteralString, args: Sequence[LiteralString], kwargs: Mapping[LiteralString, LiteralString]
) -> LiteralString: ...
@overload
def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ...
def _vformat( # undocumented
self,
format_string: str,
args: Sequence[Any],
kwargs: Mapping[str, Any],
used_args: set[int | str],
recursion_depth: int,
auto_arg_index: int = 0,
) -> tuple[str, int]: ...
def parse(
self, format_string: StrOrLiteralStr
) -> Iterable[tuple[StrOrLiteralStr, StrOrLiteralStr | None, StrOrLiteralStr | None, StrOrLiteralStr | None]]: ...
def get_field(self, field_name: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
def get_value(self, key: int | str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
def check_unused_args(self, used_args: set[int | str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ...
def format_field(self, value: Any, format_spec: str) -> Any: ...
def convert_field(self, value: Any, conversion: str | None) -> Any: ...
@@ -1,36 +0,0 @@
from collections.abc import Iterator
from types import GenericAlias
from typing import Any, Generic, Literal, TypeVar, final, overload
_T = TypeVar("_T")
@final
class Template: # TODO: consider making `Template` generic on `TypeVarTuple`
strings: tuple[str, ...]
interpolations: tuple[Interpolation[Any], ...]
def __new__(cls, *args: str | Interpolation[Any]) -> Template: ...
def __iter__(self) -> Iterator[str | Interpolation[Any]]: ...
def __add__(self, other: Template, /) -> Template: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
@property
def values(self) -> tuple[Any, ...]: ... # Tuple of interpolation values, which can have any type
@final
class Interpolation(Generic[_T]):
value: _T
expression: str
conversion: Literal["a", "r", "s"] | None
format_spec: str
__match_args__ = ("value", "expression", "conversion", "format_spec")
def __new__(
cls, value: _T, expression: str = "", conversion: Literal["a", "r", "s"] | None = None, format_spec: str = ""
) -> Interpolation[_T]: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
@overload
def convert(obj: _T, /, conversion: None) -> _T: ...
@overload
def convert(obj: object, /, conversion: Literal["r", "s", "a"]) -> str: ...
File diff suppressed because it is too large. Load diff
@@ -1,537 +0,0 @@
import sys
from _typeshed import MaybeNone, OptExcInfo, ProfileFunction, StrOrBytesPath, TraceFunction, structseq
from _typeshed.importlib import MetaPathFinderProtocol, PathEntryFinderProtocol
from builtins import object as _object
from collections.abc import AsyncGenerator, Callable, Sequence
from io import TextIOWrapper
from types import FrameType, ModuleType, SimpleNamespace, TracebackType
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeAlias, TypeVar, final, overload, type_check_only
from typing_extensions import LiteralString, deprecated
_T = TypeVar("_T")
_LazyImportMode: TypeAlias = Literal["normal", "all", "none"]
_LazyImportFilter: TypeAlias = Callable[[str | None, str, tuple[str, ...] | None], bool]
# see https://github.com/python/typeshed/issues/8513#issue-1333671093 for the rationale behind this alias
_ExitCode: TypeAlias = str | int | None
if sys.version_info >= (3, 15):
@type_check_only
class _AbiInfo(SimpleNamespace):
pointer_bits: int
free_threaded: bool
debug: bool
byteorder: Literal["little", "big"]
# ----- sys variables -----
if sys.platform != "win32":
abiflags: str
if sys.version_info >= (3, 15):
abi_info: _AbiInfo
argv: list[str]
base_exec_prefix: str
base_prefix: str
byteorder: Literal["little", "big"]
builtin_module_names: Sequence[str] # actually a tuple of strings
copyright: str
if sys.platform == "win32":
dllhandle: int
dont_write_bytecode: bool
displayhook: Callable[[object], Any]
excepthook: Callable[[type[BaseException], BaseException, TracebackType | None], Any]
exec_prefix: str
executable: str
float_repr_style: Literal["short", "legacy"]
hexversion: int
last_type: type[BaseException] | None
last_value: BaseException | None
last_traceback: TracebackType | None
if sys.version_info >= (3, 12):
last_exc: BaseException # or undefined.
maxsize: int
maxunicode: int
meta_path: list[MetaPathFinderProtocol]
modules: dict[str, ModuleType]
if sys.version_info >= (3, 15):
lazy_modules: set[str]
orig_argv: list[str]
path: list[str]
path_hooks: list[Callable[[str], PathEntryFinderProtocol]]
path_importer_cache: dict[str, PathEntryFinderProtocol | None]
platform: LiteralString
platlibdir: str
prefix: str
pycache_prefix: str | None
ps1: object
ps2: object
# TextIO is used instead of more specific types for the standard streams,
# since they are often monkeypatched at runtime. At startup, the objects
# are initialized to instances of TextIOWrapper, but can also be None under
# some circumstances.
#
# To use methods from TextIOWrapper, use an isinstance check to ensure that
# the streams have not been overridden:
#
# if isinstance(sys.stdout, io.TextIOWrapper):
# sys.stdout.reconfigure(...)
stdin: TextIO | MaybeNone
stdout: TextIO | MaybeNone
stderr: TextIO | MaybeNone
stdlib_module_names: frozenset[str]
__stdin__: Final[TextIOWrapper | None] # Contains the original value of stdin
__stdout__: Final[TextIOWrapper | None] # Contains the original value of stdout
__stderr__: Final[TextIOWrapper | None] # Contains the original value of stderr
tracebacklimit: int | None
version: str
api_version: int
warnoptions: Any
# Each entry is a tuple of the form (action, message, category, module,
# lineno)
if sys.platform == "win32":
winver: str
_xoptions: dict[Any, Any]
# Type alias used as a mixin for structseq classes that cannot be instantiated at runtime
# This can't be represented in the type system, so we just use `structseq[Any]`
_UninstantiableStructseq: TypeAlias = structseq[Any]
flags: _flags
# This class is not exposed at runtime. It calls itself sys.flags.
# As a tuple, it can have a length between 15 and 18. We don't model
# the exact length here because that varies by patch version due to
# the backported security fix int_max_str_digits. The exact length shouldn't
# be relied upon. See #13031
# 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.9 is 15 or 16-tuple
# 3.10 is 16 or 17-tuple
# 3.11+ is an 18-tuple.
@final
@type_check_only
class _flags(_UninstantiableStructseq, tuple[int, ...]):
# `safe_path` was added in py311
if sys.version_info >= (3, 11):
__match_args__: Final = (
"debug",
"inspect",
"interactive",
"optimize",
"dont_write_bytecode",
"no_user_site",
"no_site",
"ignore_environment",
"verbose",
"bytes_warning",
"quiet",
"hash_randomization",
"isolated",
"dev_mode",
"utf8_mode",
"warn_default_encoding",
"safe_path",
"int_max_str_digits",
)
else:
__match_args__: Final = (
"debug",
"inspect",
"interactive",
"optimize",
"dont_write_bytecode",
"no_user_site",
"no_site",
"ignore_environment",
"verbose",
"bytes_warning",
"quiet",
"hash_randomization",
"isolated",
"dev_mode",
"utf8_mode",
"warn_default_encoding",
"int_max_str_digits",
)
@property
def debug(self) -> int: ...
@property
def inspect(self) -> int: ...
@property
def interactive(self) -> int: ...
@property
def optimize(self) -> int: ...
@property
def dont_write_bytecode(self) -> int: ...
@property
def no_user_site(self) -> int: ...
@property
def no_site(self) -> int: ...
@property
def ignore_environment(self) -> int: ...
@property
def verbose(self) -> int: ...
@property
def bytes_warning(self) -> int: ...
@property
def quiet(self) -> int: ...
@property
def hash_randomization(self) -> int: ...
@property
def isolated(self) -> int: ...
@property
def dev_mode(self) -> bool: ...
@property
def utf8_mode(self) -> int: ...
@property
def warn_default_encoding(self) -> int: ...
if sys.version_info >= (3, 11):
@property
def safe_path(self) -> bool: ...
if sys.version_info >= (3, 13):
@property
def gil(self) -> Literal[0, 1]: ...
if sys.version_info >= (3, 14):
@property
def thread_inherit_context(self) -> Literal[0, 1]: ...
@property
def context_aware_warnings(self) -> Literal[0, 1]: ...
# 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.9.14, 3.10.7
# and present in all versions of 3.11 and later.
@property
def int_max_str_digits(self) -> int: ...
float_info: _float_info
# This class is not exposed at runtime. It calls itself sys.float_info.
@final
@type_check_only
class _float_info(structseq[float], tuple[float, int, int, float, int, int, int, int, float, int, int]):
__match_args__: Final = (
"max",
"max_exp",
"max_10_exp",
"min",
"min_exp",
"min_10_exp",
"dig",
"mant_dig",
"epsilon",
"radix",
"rounds",
)
@property
def max(self) -> float: ... # DBL_MAX
@property
def max_exp(self) -> int: ... # DBL_MAX_EXP
@property
def max_10_exp(self) -> int: ... # DBL_MAX_10_EXP
@property
def min(self) -> float: ... # DBL_MIN
@property
def min_exp(self) -> int: ... # DBL_MIN_EXP
@property
def min_10_exp(self) -> int: ... # DBL_MIN_10_EXP
@property
def dig(self) -> int: ... # DBL_DIG
@property
def mant_dig(self) -> int: ... # DBL_MANT_DIG
@property
def epsilon(self) -> float: ... # DBL_EPSILON
@property
def radix(self) -> int: ... # FLT_RADIX
@property
def rounds(self) -> int: ... # FLT_ROUNDS
hash_info: _hash_info
# This class is not exposed at runtime. It calls itself sys.hash_info.
@final
@type_check_only
class _hash_info(structseq[Any | int], tuple[int, int, int, int, int, str, int, int, int]):
__match_args__: Final = ("width", "modulus", "inf", "nan", "imag", "algorithm", "hash_bits", "seed_bits", "cutoff")
@property
def width(self) -> int: ...
@property
def modulus(self) -> int: ...
@property
def inf(self) -> int: ...
@property
def nan(self) -> int: ...
@property
def imag(self) -> int: ...
@property
def algorithm(self) -> str: ...
@property
def hash_bits(self) -> int: ...
@property
def seed_bits(self) -> int: ...
@property
def cutoff(self) -> int: ... # undocumented
implementation: _implementation
# This class isn't really a thing. At runtime, implementation is an instance
# of types.SimpleNamespace. This allows for better typing.
@type_check_only
class _implementation:
name: str
version: _version_info
hexversion: int
cache_tag: str
# Define __getattr__, as the documentation states:
# > sys.implementation may contain additional attributes specific to the Python implementation.
# > These non-standard attributes must start with an underscore, and are not described here.
def __getattr__(self, name: str) -> Any: ...
int_info: _int_info
# This class is not exposed at runtime. It calls itself sys.int_info.
@final
@type_check_only
class _int_info(structseq[int], tuple[int, int, int, int]):
__match_args__: Final = ("bits_per_digit", "sizeof_digit", "default_max_str_digits", "str_digits_check_threshold")
@property
def bits_per_digit(self) -> int: ...
@property
def sizeof_digit(self) -> int: ...
@property
def default_max_str_digits(self) -> int: ...
@property
def str_digits_check_threshold(self) -> int: ...
_ThreadInfoName: TypeAlias = Literal["nt", "pthread", "pthread-stubs", "solaris"]
_ThreadInfoLock: TypeAlias = Literal["semaphore", "mutex+cond"] | None
# This class is not exposed at runtime. It calls itself sys.thread_info.
@final
@type_check_only
class _thread_info(_UninstantiableStructseq, tuple[_ThreadInfoName, _ThreadInfoLock, str | None]):
__match_args__: Final = ("name", "lock", "version")
@property
def name(self) -> _ThreadInfoName: ...
@property
def lock(self) -> _ThreadInfoLock: ...
@property
def version(self) -> str | None: ...
thread_info: _thread_info
_ReleaseLevel: TypeAlias = Literal["alpha", "beta", "candidate", "final"]
# This class is not exposed at runtime. It calls itself sys.version_info.
@final
@type_check_only
class _version_info(_UninstantiableStructseq, tuple[int, int, int, _ReleaseLevel, int]):
__match_args__: Final = ("major", "minor", "micro", "releaselevel", "serial")
@property
def major(self) -> int: ...
@property
def minor(self) -> int: ...
@property
def micro(self) -> int: ...
@property
def releaselevel(self) -> _ReleaseLevel: ...
@property
def serial(self) -> int: ...
version_info: _version_info
def call_tracing(func: Callable[..., _T], args: Any, /) -> _T: ...
if sys.version_info >= (3, 13):
@deprecated("Deprecated since Python 3.13. Use `_clear_internal_caches()` instead.")
def _clear_type_cache() -> None: ...
else:
def _clear_type_cache() -> None: ...
def _current_frames() -> dict[int, FrameType]: ...
def _getframe(depth: int = 0, /) -> FrameType: ...
# documented -- see https://docs.python.org/3/library/sys.html#sys._current_exceptions
if sys.version_info >= (3, 12):
def _current_exceptions() -> dict[int, BaseException | None]: ...
else:
def _current_exceptions() -> dict[int, OptExcInfo]: ...
if sys.version_info >= (3, 12):
def _getframemodulename(depth: int = 0) -> str | None: ...
def _debugmallocstats() -> None: ...
def __displayhook__(object: object, /) -> None: ...
def __excepthook__(exctype: type[BaseException], value: BaseException, traceback: TracebackType | None, /) -> None: ...
def exc_info() -> OptExcInfo: ...
if sys.version_info >= (3, 11):
def exception() -> BaseException | None: ...
def exit(status: _ExitCode = None, /) -> NoReturn: ...
if sys.platform == "android": # noqa: Y008
def getandroidapilevel() -> int: ...
def getallocatedblocks() -> int: ...
def getdefaultencoding() -> Literal["utf-8"]: ...
if sys.platform != "win32":
def getdlopenflags() -> int: ...
def getfilesystemencoding() -> LiteralString: ...
def getfilesystemencodeerrors() -> LiteralString: ...
if sys.version_info >= (3, 15):
def get_lazy_imports() -> _LazyImportMode: ...
def get_lazy_imports_filter() -> _LazyImportFilter | None: ...
def getrefcount(object: Any, /) -> int: ...
def getrecursionlimit() -> int: ...
def getsizeof(obj: object, default: int = ...) -> int: ...
def getswitchinterval() -> float: ...
def getprofile() -> ProfileFunction | None: ...
def setprofile(function: ProfileFunction | None, /) -> None: ...
def gettrace() -> TraceFunction | None: ...
def settrace(function: TraceFunction | None, /) -> None: ...
if sys.platform == "win32":
# A tuple of length 5, even though it has more than 5 attributes.
@final
@type_check_only
class _WinVersion(_UninstantiableStructseq, tuple[int, int, int, int, str]):
@property
def major(self) -> int: ...
@property
def minor(self) -> int: ...
@property
def build(self) -> int: ...
@property
def platform(self) -> int: ...
@property
def service_pack(self) -> str: ...
@property
def service_pack_minor(self) -> int: ...
@property
def service_pack_major(self) -> int: ...
@property
def suite_mask(self) -> int: ...
@property
def product_type(self) -> int: ...
@property
def platform_version(self) -> tuple[int, int, int]: ...
def getwindowsversion() -> _WinVersion: ...
@overload
def intern(string: LiteralString, /) -> LiteralString: ...
@overload
def intern(string: str, /) -> str: ... # type: ignore[misc]
__interactivehook__: Callable[[], object]
if sys.version_info >= (3, 13):
def _is_gil_enabled() -> bool: ...
def _clear_internal_caches() -> None: ...
def _is_interned(string: str, /) -> bool: ...
def is_finalizing() -> bool: ...
def breakpointhook(*args: Any, **kwargs: Any) -> Any: ...
__breakpointhook__ = breakpointhook # Contains the original value of breakpointhook
if sys.platform != "win32":
def setdlopenflags(flags: int, /) -> None: ...
def setrecursionlimit(limit: int, /) -> None: ...
def setswitchinterval(interval: float, /) -> None: ...
def gettotalrefcount() -> int: ... # Debug builds only
# Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily.
@type_check_only
class UnraisableHookArgs(Protocol):
exc_type: type[BaseException]
exc_value: BaseException | None
exc_traceback: TracebackType | None
err_msg: str | None
object: _object
unraisablehook: Callable[[UnraisableHookArgs], Any]
def __unraisablehook__(unraisable: UnraisableHookArgs, /) -> Any: ...
def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None: ...
def audit(event: str, /, *args: Any) -> None: ...
_AsyncgenHook: TypeAlias = Callable[[AsyncGenerator[Any, Any]], None] | None
# This class is not exposed at runtime. It calls itself builtins.asyncgen_hooks.
@final
@type_check_only
class _asyncgen_hooks(structseq[_AsyncgenHook], tuple[_AsyncgenHook, _AsyncgenHook]):
__match_args__: Final = ("firstiter", "finalizer")
@property
def firstiter(self) -> _AsyncgenHook: ...
@property
def finalizer(self) -> _AsyncgenHook: ...
def get_asyncgen_hooks() -> _asyncgen_hooks: ...
def set_asyncgen_hooks(firstiter: _AsyncgenHook = ..., finalizer: _AsyncgenHook = ...) -> None: ...
if sys.platform == "win32":
if sys.version_info >= (3, 13):
@deprecated(
"Deprecated since Python 3.13; will be removed in Python 3.16. "
"Use the `PYTHONLEGACYWINDOWSFSENCODING` environment variable instead."
)
def _enablelegacywindowsfsencoding() -> None: ...
else:
def _enablelegacywindowsfsencoding() -> None: ...
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, 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: ...
if sys.version_info >= (3, 15):
def set_lazy_imports(mode: _LazyImportMode) -> None: ...
def set_lazy_imports_filter(filter: _LazyImportFilter | None) -> None: ...
if sys.version_info >= (3, 12):
if sys.version_info >= (3, 13):
def getunicodeinternedsize(*, _only_immortal: bool = False) -> int: ...
else:
def getunicodeinternedsize() -> int: ...
def deactivate_stack_trampoline() -> None: ...
def is_stack_trampoline_active() -> bool: ...
# It always exists, but raises on non-linux platforms:
if sys.platform == "linux":
def activate_stack_trampoline(backend: str, /) -> None: ...
else:
def activate_stack_trampoline(backend: str, /) -> NoReturn: ...
from . import _monitoring
monitoring = _monitoring
if sys.version_info >= (3, 14):
def is_remote_debug_enabled() -> bool: ...
def remote_exec(pid: int, script: StrOrBytesPath) -> None: ...
def _is_immortal(op: object, /) -> bool: ...
from . import __jit
_jit = __jit
@@ -1,11 +0,0 @@
# This py314+ module provides annotations for `sys._jit`.
# It's named `sys.__jit` in typeshed,
# because trying to import `sys._jit` will fail at runtime!
# At runtime, `sys._jit` has the unusual status
# of being a `types.ModuleType` instance that cannot be directly imported,
# (same as sys.monitoring)
# and exists in the `sys`-module namespace despite `sys` not being a package.
def is_available() -> bool: ...
def is_enabled() -> bool: ...
def is_active() -> bool: ...
@@ -1,69 +0,0 @@
# This py312+ module provides annotations for `sys.monitoring`.
# It's named `sys._monitoring` in typeshed,
# because trying to import `sys.monitoring` will fail at runtime!
# At runtime, `sys.monitoring` has the unusual status
# of being a `types.ModuleType` instance that cannot be directly imported,
# (same as sys._jit)
# and exists in the `sys`-module namespace despite `sys` not being a package.
import sys
from collections.abc import Callable
from types import CodeType
from typing import Any, Final, type_check_only
from typing_extensions import deprecated
DEBUGGER_ID: Final = 0
COVERAGE_ID: Final = 1
PROFILER_ID: Final = 2
OPTIMIZER_ID: Final = 5
def use_tool_id(tool_id: int, name: str, /) -> None: ...
if sys.version_info >= (3, 14):
def clear_tool_id(tool_id: int, /) -> None: ...
def free_tool_id(tool_id: int, /) -> None: ...
def get_tool(tool_id: int, /) -> str | None: ...
events: Final[_events]
@type_check_only
class _events:
CALL: Final[int]
C_RAISE: Final[int]
C_RETURN: Final[int]
EXCEPTION_HANDLED: Final[int]
INSTRUCTION: Final[int]
JUMP: Final[int]
LINE: Final[int]
NO_EVENTS: Final[int]
PY_RESUME: Final[int]
PY_RETURN: Final[int]
PY_START: Final[int]
PY_THROW: Final[int]
PY_UNWIND: Final[int]
PY_YIELD: Final[int]
RAISE: Final[int]
RERAISE: Final[int]
STOP_ITERATION: Final[int]
if sys.version_info >= (3, 14):
BRANCH_LEFT: Final[int]
BRANCH_RIGHT: Final[int]
@property
@deprecated("Deprecated since Python 3.14. Use `BRANCH_LEFT` or `BRANCH_RIGHT` instead.")
def BRANCH(self) -> int: ...
else:
BRANCH: Final[int]
def get_events(tool_id: int, /) -> int: ...
def set_events(tool_id: int, event_set: int, /) -> None: ...
def get_local_events(tool_id: int, code: CodeType, /) -> int: ...
def set_local_events(tool_id: int, code: CodeType, event_set: int, /) -> None: ...
def restart_events() -> None: ...
DISABLE: Final[object]
MISSING: Final[object]
def register_callback(tool_id: int, event: int, func: Callable[..., object] | None, /) -> Callable[..., Any] | None: ...
@@ -1,2 +0,0 @@
s: str
d: dict[str, str]