From 0be56b39ae68ad8617b80f4b290b2b78ed4da8b1 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sun, 2 Aug 2026 15:25:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BA=86=20ViperOS=20?= =?UTF-8?q?=E7=9A=84=E5=9F=BA=E6=9C=AC=E9=AB=98=E4=BA=AE=EF=BC=8C=E6=AD=A3?= =?UTF-8?q?=E5=9C=A8=E5=AE=8C=E5=96=84=E5=AF=B9=20includes=20=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/analyzer/importResolver.ts | 27 +- .../src/analyzer/typeEvaluator.ts | 123 +- .../src/common/configOptions.ts | 16 + .../typeshed-fallback/stdlib/argparse.vpi | 864 --------- .../typeshed-fallback/stdlib/base64.vpi | 124 -- .../typeshed-fallback/stdlib/binascii.vpi | 102 -- .../typeshed-fallback/stdlib/posix.vpi | 427 ----- .../typeshed-fallback/stdlib/shutil.vpi | 243 --- .../typeshed-fallback/stdlib/socket.vpi | 1581 ----------------- .../stdlib/string/__init__.vpi | 81 - .../stdlib/string/templatelib.vpi | 36 - .../typeshed-fallback/stdlib/subprocess.vpi | 1484 ---------------- .../typeshed-fallback/stdlib/sys/__init__.vpi | 537 ------ .../typeshed-fallback/stdlib/sys/__jit.vpi | 11 - .../stdlib/sys/_monitoring.vpi | 69 - .../typeshed-fallback/stdlib/this.vpi | 2 - 16 files changed, 105 insertions(+), 5622 deletions(-) delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/argparse.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/base64.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/binascii.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/posix.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/shutil.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/socket.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/string/__init__.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/string/templatelib.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/subprocess.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/sys/__init__.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/sys/__jit.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/sys/_monitoring.vpi delete mode 100644 packages/vipeye-internal/typeshed-fallback/stdlib/this.vpi diff --git a/packages/vipeye-internal/src/analyzer/importResolver.ts b/packages/vipeye-internal/src/analyzer/importResolver.ts index 84e67cf7..a0ea9c69 100644 --- a/packages/vipeye-internal/src/analyzer/importResolver.ts +++ b/packages/vipeye-internal/src/analyzer/importResolver.ts @@ -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); } diff --git a/packages/vipeye-internal/src/analyzer/typeEvaluator.ts b/packages/vipeye-internal/src/analyzer/typeEvaluator.ts index 30dbff06..49f806bc 100644 --- a/packages/vipeye-internal/src/analyzer/typeEvaluator.ts +++ b/packages/vipeye-internal/src/analyzer/typeEvaluator.ts @@ -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; diff --git a/packages/vipeye-internal/src/common/configOptions.ts b/packages/vipeye-internal/src/common/configOptions.ts index 0f742dd2..eb96be9f 100644 --- a/packages/vipeye-internal/src/common/configOptions.ts +++ b/packages/vipeye-internal/src/common/configOptions.ts @@ -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; diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/argparse.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/argparse.vpi deleted file mode 100644 index 22d330a0..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/argparse.vpi +++ /dev/null @@ -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: ... diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/base64.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/base64.vpi deleted file mode 100644 index dd478214..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/base64.vpi +++ /dev/null @@ -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: ... diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/binascii.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/binascii.vpi deleted file mode 100644 index 6840c688..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/binascii.vpi +++ /dev/null @@ -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): ... diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/posix.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/posix.vpi deleted file mode 100644 index 36bb5be1..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/posix.vpi +++ /dev/null @@ -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] diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/shutil.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/shutil.vpi deleted file mode 100644 index badb0bae..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/shutil.vpi +++ /dev/null @@ -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: ... diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/socket.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/socket.vpi deleted file mode 100644 index 87e2bd35..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/socket.vpi +++ /dev/null @@ -1,1581 +0,0 @@ -# Ideally, we'd just do "from _socket import *". Unfortunately, socket -# overrides some definitions from _socket incompatibly. mypy incorrectly -# prefers the definitions from _socket over those defined here. -import _socket -import sys -from _socket import ( - CAPI as CAPI, - EAI_AGAIN as EAI_AGAIN, - EAI_BADFLAGS as EAI_BADFLAGS, - EAI_FAIL as EAI_FAIL, - EAI_FAMILY as EAI_FAMILY, - EAI_MEMORY as EAI_MEMORY, - EAI_NODATA as EAI_NODATA, - EAI_NONAME as EAI_NONAME, - EAI_SERVICE as EAI_SERVICE, - EAI_SOCKTYPE as EAI_SOCKTYPE, - INADDR_ALLHOSTS_GROUP as INADDR_ALLHOSTS_GROUP, - INADDR_ANY as INADDR_ANY, - INADDR_BROADCAST as INADDR_BROADCAST, - INADDR_LOOPBACK as INADDR_LOOPBACK, - INADDR_MAX_LOCAL_GROUP as INADDR_MAX_LOCAL_GROUP, - INADDR_NONE as INADDR_NONE, - INADDR_UNSPEC_GROUP as INADDR_UNSPEC_GROUP, - IP_ADD_MEMBERSHIP as IP_ADD_MEMBERSHIP, - IP_DROP_MEMBERSHIP as IP_DROP_MEMBERSHIP, - IP_HDRINCL as IP_HDRINCL, - IP_MULTICAST_IF as IP_MULTICAST_IF, - IP_MULTICAST_LOOP as IP_MULTICAST_LOOP, - IP_MULTICAST_TTL as IP_MULTICAST_TTL, - IP_OPTIONS as IP_OPTIONS, - IP_RECVTOS as IP_RECVTOS, - IP_TOS as IP_TOS, - IP_TTL as IP_TTL, - IPPORT_RESERVED as IPPORT_RESERVED, - IPPORT_USERRESERVED as IPPORT_USERRESERVED, - IPPROTO_AH as IPPROTO_AH, - IPPROTO_DSTOPTS as IPPROTO_DSTOPTS, - IPPROTO_EGP as IPPROTO_EGP, - IPPROTO_ESP as IPPROTO_ESP, - IPPROTO_FRAGMENT as IPPROTO_FRAGMENT, - IPPROTO_HOPOPTS as IPPROTO_HOPOPTS, - IPPROTO_ICMP as IPPROTO_ICMP, - IPPROTO_ICMPV6 as IPPROTO_ICMPV6, - IPPROTO_IDP as IPPROTO_IDP, - IPPROTO_IGMP as IPPROTO_IGMP, - IPPROTO_IP as IPPROTO_IP, - IPPROTO_IPV6 as IPPROTO_IPV6, - IPPROTO_NONE as IPPROTO_NONE, - IPPROTO_PIM as IPPROTO_PIM, - IPPROTO_PUP as IPPROTO_PUP, - IPPROTO_RAW as IPPROTO_RAW, - IPPROTO_ROUTING as IPPROTO_ROUTING, - IPPROTO_SCTP as IPPROTO_SCTP, - IPPROTO_TCP as IPPROTO_TCP, - IPPROTO_UDP as IPPROTO_UDP, - IPV6_CHECKSUM as IPV6_CHECKSUM, - IPV6_DONTFRAG as IPV6_DONTFRAG, - IPV6_HOPLIMIT as IPV6_HOPLIMIT, - IPV6_HOPOPTS as IPV6_HOPOPTS, - IPV6_JOIN_GROUP as IPV6_JOIN_GROUP, - IPV6_LEAVE_GROUP as IPV6_LEAVE_GROUP, - IPV6_MULTICAST_HOPS as IPV6_MULTICAST_HOPS, - IPV6_MULTICAST_IF as IPV6_MULTICAST_IF, - IPV6_MULTICAST_LOOP as IPV6_MULTICAST_LOOP, - IPV6_PKTINFO as IPV6_PKTINFO, - IPV6_RECVRTHDR as IPV6_RECVRTHDR, - IPV6_RECVTCLASS as IPV6_RECVTCLASS, - IPV6_RTHDR as IPV6_RTHDR, - IPV6_TCLASS as IPV6_TCLASS, - IPV6_UNICAST_HOPS as IPV6_UNICAST_HOPS, - IPV6_V6ONLY as IPV6_V6ONLY, - NI_DGRAM as NI_DGRAM, - NI_MAXHOST as NI_MAXHOST, - NI_MAXSERV as NI_MAXSERV, - NI_NAMEREQD as NI_NAMEREQD, - NI_NOFQDN as NI_NOFQDN, - NI_NUMERICHOST as NI_NUMERICHOST, - NI_NUMERICSERV as NI_NUMERICSERV, - SHUT_RD as SHUT_RD, - SHUT_RDWR as SHUT_RDWR, - SHUT_WR as SHUT_WR, - SO_ACCEPTCONN as SO_ACCEPTCONN, - SO_BROADCAST as SO_BROADCAST, - SO_DEBUG as SO_DEBUG, - SO_DONTROUTE as SO_DONTROUTE, - SO_ERROR as SO_ERROR, - SO_KEEPALIVE as SO_KEEPALIVE, - SO_LINGER as SO_LINGER, - SO_OOBINLINE as SO_OOBINLINE, - SO_RCVBUF as SO_RCVBUF, - SO_RCVLOWAT as SO_RCVLOWAT, - SO_RCVTIMEO as SO_RCVTIMEO, - SO_REUSEADDR as SO_REUSEADDR, - SO_SNDBUF as SO_SNDBUF, - SO_SNDLOWAT as SO_SNDLOWAT, - SO_SNDTIMEO as SO_SNDTIMEO, - SO_TYPE as SO_TYPE, - SOL_IP as SOL_IP, - SOL_SOCKET as SOL_SOCKET, - SOL_TCP as SOL_TCP, - SOL_UDP as SOL_UDP, - SOMAXCONN as SOMAXCONN, - TCP_FASTOPEN as TCP_FASTOPEN, - TCP_KEEPCNT as TCP_KEEPCNT, - TCP_KEEPINTVL as TCP_KEEPINTVL, - TCP_MAXSEG as TCP_MAXSEG, - TCP_NODELAY as TCP_NODELAY, - SocketType as SocketType, - _Address as _Address, - _RetAddress as _RetAddress, - close as close, - dup as dup, - getdefaulttimeout as getdefaulttimeout, - gethostbyaddr as gethostbyaddr, - gethostbyname as gethostbyname, - gethostbyname_ex as gethostbyname_ex, - gethostname as gethostname, - getnameinfo as getnameinfo, - getprotobyname as getprotobyname, - getservbyname as getservbyname, - getservbyport as getservbyport, - has_ipv6 as has_ipv6, - htonl as htonl, - htons as htons, - if_indextoname as if_indextoname, - if_nameindex as if_nameindex, - if_nametoindex as if_nametoindex, - inet_aton as inet_aton, - inet_ntoa as inet_ntoa, - inet_ntop as inet_ntop, - inet_pton as inet_pton, - ntohl as ntohl, - ntohs as ntohs, - setdefaulttimeout as setdefaulttimeout, -) -from _typeshed import ReadableBuffer, Unused, WriteableBuffer -from collections.abc import Iterable -from enum import IntEnum, IntFlag -from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase, TextIOWrapper -from typing import Any, Final, Literal, Protocol, SupportsIndex, overload, type_check_only -from typing_extensions import Self - -__all__ = [ - "fromfd", - "getfqdn", - "create_connection", - "create_server", - "has_dualstack_ipv6", - "AddressFamily", - "SocketKind", - "AF_APPLETALK", - "AF_DECnet", - "AF_INET", - "AF_INET6", - "AF_IPX", - "AF_SNA", - "AF_UNSPEC", - "AI_ADDRCONFIG", - "AI_ALL", - "AI_CANONNAME", - "AI_NUMERICHOST", - "AI_NUMERICSERV", - "AI_PASSIVE", - "AI_V4MAPPED", - "CAPI", - "EAI_AGAIN", - "EAI_BADFLAGS", - "EAI_FAIL", - "EAI_FAMILY", - "EAI_MEMORY", - "EAI_NODATA", - "EAI_NONAME", - "EAI_SERVICE", - "EAI_SOCKTYPE", - "INADDR_ALLHOSTS_GROUP", - "INADDR_ANY", - "INADDR_BROADCAST", - "INADDR_LOOPBACK", - "INADDR_MAX_LOCAL_GROUP", - "INADDR_NONE", - "INADDR_UNSPEC_GROUP", - "IPPORT_RESERVED", - "IPPORT_USERRESERVED", - "IPPROTO_AH", - "IPPROTO_DSTOPTS", - "IPPROTO_EGP", - "IPPROTO_ESP", - "IPPROTO_FRAGMENT", - "IPPROTO_HOPOPTS", - "IPPROTO_ICMP", - "IPPROTO_ICMPV6", - "IPPROTO_IDP", - "IPPROTO_IGMP", - "IPPROTO_IP", - "IPPROTO_IPV6", - "IPPROTO_NONE", - "IPPROTO_PIM", - "IPPROTO_PUP", - "IPPROTO_RAW", - "IPPROTO_ROUTING", - "IPPROTO_SCTP", - "IPPROTO_TCP", - "IPPROTO_UDP", - "IPV6_CHECKSUM", - "IPV6_DONTFRAG", - "IPV6_HOPLIMIT", - "IPV6_HOPOPTS", - "IPV6_JOIN_GROUP", - "IPV6_LEAVE_GROUP", - "IPV6_MULTICAST_HOPS", - "IPV6_MULTICAST_IF", - "IPV6_MULTICAST_LOOP", - "IPV6_PKTINFO", - "IPV6_RECVRTHDR", - "IPV6_RECVTCLASS", - "IPV6_RTHDR", - "IPV6_TCLASS", - "IPV6_UNICAST_HOPS", - "IPV6_V6ONLY", - "IP_ADD_MEMBERSHIP", - "IP_DROP_MEMBERSHIP", - "IP_HDRINCL", - "IP_MULTICAST_IF", - "IP_MULTICAST_LOOP", - "IP_MULTICAST_TTL", - "IP_OPTIONS", - "IP_RECVTOS", - "IP_TOS", - "IP_TTL", - "MSG_CTRUNC", - "MSG_DONTROUTE", - "MSG_OOB", - "MSG_PEEK", - "MSG_TRUNC", - "MSG_WAITALL", - "NI_DGRAM", - "NI_MAXHOST", - "NI_MAXSERV", - "NI_NAMEREQD", - "NI_NOFQDN", - "NI_NUMERICHOST", - "NI_NUMERICSERV", - "SHUT_RD", - "SHUT_RDWR", - "SHUT_WR", - "SOCK_DGRAM", - "SOCK_RAW", - "SOCK_RDM", - "SOCK_SEQPACKET", - "SOCK_STREAM", - "SOL_IP", - "SOL_SOCKET", - "SOL_TCP", - "SOL_UDP", - "SOMAXCONN", - "SO_ACCEPTCONN", - "SO_BROADCAST", - "SO_DEBUG", - "SO_DONTROUTE", - "SO_ERROR", - "SO_KEEPALIVE", - "SO_LINGER", - "SO_OOBINLINE", - "SO_RCVBUF", - "SO_RCVLOWAT", - "SO_RCVTIMEO", - "SO_REUSEADDR", - "SO_SNDBUF", - "SO_SNDLOWAT", - "SO_SNDTIMEO", - "SO_TYPE", - "SocketType", - "TCP_FASTOPEN", - "TCP_KEEPCNT", - "TCP_KEEPINTVL", - "TCP_MAXSEG", - "TCP_NODELAY", - "close", - "dup", - "error", - "gaierror", - "getaddrinfo", - "getdefaulttimeout", - "gethostbyaddr", - "gethostbyname", - "gethostbyname_ex", - "gethostname", - "getnameinfo", - "getprotobyname", - "getservbyname", - "getservbyport", - "has_ipv6", - "herror", - "htonl", - "htons", - "if_indextoname", - "if_nameindex", - "if_nametoindex", - "inet_aton", - "inet_ntoa", - "inet_ntop", - "inet_pton", - "ntohl", - "ntohs", - "setdefaulttimeout", - "socket", - "socketpair", - "timeout", -] - -if sys.platform == "win32": - from _socket import ( - IPPROTO_CBT as IPPROTO_CBT, - IPPROTO_ICLFXBM as IPPROTO_ICLFXBM, - IPPROTO_IGP as IPPROTO_IGP, - IPPROTO_L2TP as IPPROTO_L2TP, - IPPROTO_PGM as IPPROTO_PGM, - IPPROTO_RDP as IPPROTO_RDP, - IPPROTO_ST as IPPROTO_ST, - RCVALL_MAX as RCVALL_MAX, - RCVALL_OFF as RCVALL_OFF, - RCVALL_ON as RCVALL_ON, - RCVALL_SOCKETLEVELONLY as RCVALL_SOCKETLEVELONLY, - SIO_KEEPALIVE_VALS as SIO_KEEPALIVE_VALS, - SIO_LOOPBACK_FAST_PATH as SIO_LOOPBACK_FAST_PATH, - SIO_RCVALL as SIO_RCVALL, - SO_EXCLUSIVEADDRUSE as SO_EXCLUSIVEADDRUSE, - ) - - __all__ += [ - "IPPROTO_CBT", - "IPPROTO_ICLFXBM", - "IPPROTO_IGP", - "IPPROTO_L2TP", - "IPPROTO_PGM", - "IPPROTO_RDP", - "IPPROTO_ST", - "RCVALL_MAX", - "RCVALL_OFF", - "RCVALL_ON", - "RCVALL_SOCKETLEVELONLY", - "SIO_KEEPALIVE_VALS", - "SIO_LOOPBACK_FAST_PATH", - "SIO_RCVALL", - "SO_EXCLUSIVEADDRUSE", - "fromshare", - "errorTab", - "MSG_BCAST", - "MSG_MCAST", - ] - -if sys.platform == "darwin": - from _socket import PF_SYSTEM as PF_SYSTEM, SYSPROTO_CONTROL as SYSPROTO_CONTROL - - __all__ += ["PF_SYSTEM", "SYSPROTO_CONTROL", "AF_SYSTEM"] - -if sys.platform != "darwin": - from _socket import TCP_KEEPIDLE as TCP_KEEPIDLE - - __all__ += ["TCP_KEEPIDLE", "AF_IRDA", "MSG_ERRQUEUE"] - -if sys.platform != "win32" and sys.platform != "darwin": - from _socket import ( - IP_TRANSPARENT as IP_TRANSPARENT, - IPX_TYPE as IPX_TYPE, - SCM_CREDENTIALS as SCM_CREDENTIALS, - SO_DOMAIN as SO_DOMAIN, - SO_MARK as SO_MARK, - SO_PASSCRED as SO_PASSCRED, - SO_PASSSEC as SO_PASSSEC, - SO_PEERCRED as SO_PEERCRED, - SO_PEERSEC as SO_PEERSEC, - SO_PRIORITY as SO_PRIORITY, - SO_PROTOCOL as SO_PROTOCOL, - SOL_ATALK as SOL_ATALK, - SOL_AX25 as SOL_AX25, - SOL_HCI as SOL_HCI, - SOL_IPX as SOL_IPX, - SOL_NETROM as SOL_NETROM, - SOL_ROSE as SOL_ROSE, - TCP_CONGESTION as TCP_CONGESTION, - TCP_CORK as TCP_CORK, - TCP_DEFER_ACCEPT as TCP_DEFER_ACCEPT, - TCP_INFO as TCP_INFO, - TCP_LINGER2 as TCP_LINGER2, - TCP_QUICKACK as TCP_QUICKACK, - TCP_SYNCNT as TCP_SYNCNT, - TCP_USER_TIMEOUT as TCP_USER_TIMEOUT, - TCP_WINDOW_CLAMP as TCP_WINDOW_CLAMP, - ) - - __all__ += [ - "IP_TRANSPARENT", - "SCM_CREDENTIALS", - "SO_DOMAIN", - "SO_MARK", - "SO_PASSCRED", - "SO_PASSSEC", - "SO_PEERCRED", - "SO_PEERSEC", - "SO_PRIORITY", - "SO_PROTOCOL", - "TCP_CONGESTION", - "TCP_CORK", - "TCP_DEFER_ACCEPT", - "TCP_INFO", - "TCP_LINGER2", - "TCP_QUICKACK", - "TCP_SYNCNT", - "TCP_USER_TIMEOUT", - "TCP_WINDOW_CLAMP", - "AF_ASH", - "AF_ATMPVC", - "AF_ATMSVC", - "AF_AX25", - "AF_BRIDGE", - "AF_ECONET", - "AF_KEY", - "AF_LLC", - "AF_NETBEUI", - "AF_NETROM", - "AF_PPPOX", - "AF_ROSE", - "AF_SECURITY", - "AF_WANPIPE", - "AF_X25", - "MSG_CMSG_CLOEXEC", - "MSG_CONFIRM", - "MSG_FASTOPEN", - "MSG_MORE", - ] - -if sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 11): - from _socket import IP_BIND_ADDRESS_NO_PORT as IP_BIND_ADDRESS_NO_PORT - - __all__ += ["IP_BIND_ADDRESS_NO_PORT"] - -if sys.platform != "win32": - from _socket import ( - CMSG_LEN as CMSG_LEN, - CMSG_SPACE as CMSG_SPACE, - EAI_ADDRFAMILY as EAI_ADDRFAMILY, - EAI_OVERFLOW as EAI_OVERFLOW, - EAI_SYSTEM as EAI_SYSTEM, - IP_DEFAULT_MULTICAST_LOOP as IP_DEFAULT_MULTICAST_LOOP, - IP_DEFAULT_MULTICAST_TTL as IP_DEFAULT_MULTICAST_TTL, - IP_MAX_MEMBERSHIPS as IP_MAX_MEMBERSHIPS, - IP_RECVOPTS as IP_RECVOPTS, - IP_RECVRETOPTS as IP_RECVRETOPTS, - IP_RETOPTS as IP_RETOPTS, - IPPROTO_GRE as IPPROTO_GRE, - IPPROTO_IPIP as IPPROTO_IPIP, - IPPROTO_RSVP as IPPROTO_RSVP, - IPPROTO_TP as IPPROTO_TP, - IPV6_RTHDR_TYPE_0 as IPV6_RTHDR_TYPE_0, - SCM_RIGHTS as SCM_RIGHTS, - SO_REUSEPORT as SO_REUSEPORT, - TCP_NOTSENT_LOWAT as TCP_NOTSENT_LOWAT, - sethostname as sethostname, - ) - - __all__ += [ - "CMSG_LEN", - "CMSG_SPACE", - "EAI_ADDRFAMILY", - "EAI_OVERFLOW", - "EAI_SYSTEM", - "IP_DEFAULT_MULTICAST_LOOP", - "IP_DEFAULT_MULTICAST_TTL", - "IP_MAX_MEMBERSHIPS", - "IP_RECVOPTS", - "IP_RECVRETOPTS", - "IP_RETOPTS", - "IPPROTO_GRE", - "IPPROTO_IPIP", - "IPPROTO_RSVP", - "IPPROTO_TP", - "IPV6_RTHDR_TYPE_0", - "SCM_RIGHTS", - "SO_REUSEPORT", - "TCP_NOTSENT_LOWAT", - "sethostname", - "AF_ROUTE", - "AF_UNIX", - "MSG_DONTWAIT", - "MSG_EOR", - "MSG_NOSIGNAL", - ] - - from _socket import ( - IPV6_DSTOPTS as IPV6_DSTOPTS, - IPV6_NEXTHOP as IPV6_NEXTHOP, - IPV6_PATHMTU as IPV6_PATHMTU, - IPV6_RECVDSTOPTS as IPV6_RECVDSTOPTS, - IPV6_RECVHOPLIMIT as IPV6_RECVHOPLIMIT, - IPV6_RECVHOPOPTS as IPV6_RECVHOPOPTS, - IPV6_RECVPATHMTU as IPV6_RECVPATHMTU, - IPV6_RECVPKTINFO as IPV6_RECVPKTINFO, - IPV6_RTHDRDSTOPTS as IPV6_RTHDRDSTOPTS, - ) - - __all__ += [ - "IPV6_DSTOPTS", - "IPV6_NEXTHOP", - "IPV6_PATHMTU", - "IPV6_RECVDSTOPTS", - "IPV6_RECVHOPLIMIT", - "IPV6_RECVHOPOPTS", - "IPV6_RECVPATHMTU", - "IPV6_RECVPKTINFO", - "IPV6_RTHDRDSTOPTS", - ] - - if sys.platform != "darwin" or sys.version_info >= (3, 13): - from _socket import SO_BINDTODEVICE as SO_BINDTODEVICE - - __all__ += ["SO_BINDTODEVICE"] - -if sys.platform != "darwin": - from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM - -if sys.platform != "darwin" and sys.platform != "linux": - __all__ += ["BDADDR_ANY", "BDADDR_LOCAL", "BTPROTO_RFCOMM"] - -if sys.platform == "darwin": - from _socket import TCP_KEEPALIVE as TCP_KEEPALIVE - - __all__ += ["TCP_KEEPALIVE"] - -if sys.platform == "darwin" and sys.version_info >= (3, 11): - from _socket import TCP_CONNECTION_INFO as TCP_CONNECTION_INFO - - __all__ += ["TCP_CONNECTION_INFO"] - -if sys.platform == "linux": - from _socket import ( - ALG_OP_DECRYPT as ALG_OP_DECRYPT, - ALG_OP_ENCRYPT as ALG_OP_ENCRYPT, - ALG_OP_SIGN as ALG_OP_SIGN, - ALG_OP_VERIFY as ALG_OP_VERIFY, - ALG_SET_AEAD_ASSOCLEN as ALG_SET_AEAD_ASSOCLEN, - ALG_SET_AEAD_AUTHSIZE as ALG_SET_AEAD_AUTHSIZE, - ALG_SET_IV as ALG_SET_IV, - ALG_SET_KEY as ALG_SET_KEY, - ALG_SET_OP as ALG_SET_OP, - ALG_SET_PUBKEY as ALG_SET_PUBKEY, - CAN_BCM as CAN_BCM, - CAN_BCM_CAN_FD_FRAME as CAN_BCM_CAN_FD_FRAME, - CAN_BCM_RX_ANNOUNCE_RESUME as CAN_BCM_RX_ANNOUNCE_RESUME, - CAN_BCM_RX_CHANGED as CAN_BCM_RX_CHANGED, - CAN_BCM_RX_CHECK_DLC as CAN_BCM_RX_CHECK_DLC, - CAN_BCM_RX_DELETE as CAN_BCM_RX_DELETE, - CAN_BCM_RX_FILTER_ID as CAN_BCM_RX_FILTER_ID, - CAN_BCM_RX_NO_AUTOTIMER as CAN_BCM_RX_NO_AUTOTIMER, - CAN_BCM_RX_READ as CAN_BCM_RX_READ, - CAN_BCM_RX_RTR_FRAME as CAN_BCM_RX_RTR_FRAME, - CAN_BCM_RX_SETUP as CAN_BCM_RX_SETUP, - CAN_BCM_RX_STATUS as CAN_BCM_RX_STATUS, - CAN_BCM_RX_TIMEOUT as CAN_BCM_RX_TIMEOUT, - CAN_BCM_SETTIMER as CAN_BCM_SETTIMER, - CAN_BCM_STARTTIMER as CAN_BCM_STARTTIMER, - CAN_BCM_TX_ANNOUNCE as CAN_BCM_TX_ANNOUNCE, - CAN_BCM_TX_COUNTEVT as CAN_BCM_TX_COUNTEVT, - CAN_BCM_TX_CP_CAN_ID as CAN_BCM_TX_CP_CAN_ID, - CAN_BCM_TX_DELETE as CAN_BCM_TX_DELETE, - CAN_BCM_TX_EXPIRED as CAN_BCM_TX_EXPIRED, - CAN_BCM_TX_READ as CAN_BCM_TX_READ, - CAN_BCM_TX_RESET_MULTI_IDX as CAN_BCM_TX_RESET_MULTI_IDX, - CAN_BCM_TX_SEND as CAN_BCM_TX_SEND, - CAN_BCM_TX_SETUP as CAN_BCM_TX_SETUP, - CAN_BCM_TX_STATUS as CAN_BCM_TX_STATUS, - CAN_EFF_FLAG as CAN_EFF_FLAG, - CAN_EFF_MASK as CAN_EFF_MASK, - CAN_ERR_FLAG as CAN_ERR_FLAG, - CAN_ERR_MASK as CAN_ERR_MASK, - CAN_ISOTP as CAN_ISOTP, - CAN_RAW as CAN_RAW, - CAN_RAW_FD_FRAMES as CAN_RAW_FD_FRAMES, - CAN_RAW_FILTER as CAN_RAW_FILTER, - CAN_RAW_LOOPBACK as CAN_RAW_LOOPBACK, - CAN_RAW_RECV_OWN_MSGS as CAN_RAW_RECV_OWN_MSGS, - CAN_RTR_FLAG as CAN_RTR_FLAG, - CAN_SFF_MASK as CAN_SFF_MASK, - IOCTL_VM_SOCKETS_GET_LOCAL_CID as IOCTL_VM_SOCKETS_GET_LOCAL_CID, - NETLINK_CRYPTO as NETLINK_CRYPTO, - NETLINK_DNRTMSG as NETLINK_DNRTMSG, - NETLINK_FIREWALL as NETLINK_FIREWALL, - NETLINK_IP6_FW as NETLINK_IP6_FW, - NETLINK_NFLOG as NETLINK_NFLOG, - NETLINK_ROUTE as NETLINK_ROUTE, - NETLINK_USERSOCK as NETLINK_USERSOCK, - NETLINK_XFRM as NETLINK_XFRM, - PACKET_BROADCAST as PACKET_BROADCAST, - PACKET_FASTROUTE as PACKET_FASTROUTE, - PACKET_HOST as PACKET_HOST, - PACKET_LOOPBACK as PACKET_LOOPBACK, - PACKET_MULTICAST as PACKET_MULTICAST, - PACKET_OTHERHOST as PACKET_OTHERHOST, - PACKET_OUTGOING as PACKET_OUTGOING, - PF_CAN as PF_CAN, - PF_PACKET as PF_PACKET, - PF_RDS as PF_RDS, - RDS_CANCEL_SENT_TO as RDS_CANCEL_SENT_TO, - RDS_CMSG_RDMA_ARGS as RDS_CMSG_RDMA_ARGS, - RDS_CMSG_RDMA_DEST as RDS_CMSG_RDMA_DEST, - RDS_CMSG_RDMA_MAP as RDS_CMSG_RDMA_MAP, - RDS_CMSG_RDMA_STATUS as RDS_CMSG_RDMA_STATUS, - RDS_CONG_MONITOR as RDS_CONG_MONITOR, - RDS_FREE_MR as RDS_FREE_MR, - RDS_GET_MR as RDS_GET_MR, - RDS_GET_MR_FOR_DEST as RDS_GET_MR_FOR_DEST, - RDS_RDMA_DONTWAIT as RDS_RDMA_DONTWAIT, - RDS_RDMA_FENCE as RDS_RDMA_FENCE, - RDS_RDMA_INVALIDATE as RDS_RDMA_INVALIDATE, - RDS_RDMA_NOTIFY_ME as RDS_RDMA_NOTIFY_ME, - RDS_RDMA_READWRITE as RDS_RDMA_READWRITE, - RDS_RDMA_SILENT as RDS_RDMA_SILENT, - RDS_RDMA_USE_ONCE as RDS_RDMA_USE_ONCE, - RDS_RECVERR as RDS_RECVERR, - SO_VM_SOCKETS_BUFFER_MAX_SIZE as SO_VM_SOCKETS_BUFFER_MAX_SIZE, - SO_VM_SOCKETS_BUFFER_MIN_SIZE as SO_VM_SOCKETS_BUFFER_MIN_SIZE, - SO_VM_SOCKETS_BUFFER_SIZE as SO_VM_SOCKETS_BUFFER_SIZE, - SOL_ALG as SOL_ALG, - SOL_CAN_BASE as SOL_CAN_BASE, - SOL_CAN_RAW as SOL_CAN_RAW, - SOL_RDS as SOL_RDS, - SOL_TIPC as SOL_TIPC, - TIPC_ADDR_ID as TIPC_ADDR_ID, - TIPC_ADDR_NAME as TIPC_ADDR_NAME, - TIPC_ADDR_NAMESEQ as TIPC_ADDR_NAMESEQ, - TIPC_CFG_SRV as TIPC_CFG_SRV, - TIPC_CLUSTER_SCOPE as TIPC_CLUSTER_SCOPE, - TIPC_CONN_TIMEOUT as TIPC_CONN_TIMEOUT, - TIPC_CRITICAL_IMPORTANCE as TIPC_CRITICAL_IMPORTANCE, - TIPC_DEST_DROPPABLE as TIPC_DEST_DROPPABLE, - TIPC_HIGH_IMPORTANCE as TIPC_HIGH_IMPORTANCE, - TIPC_IMPORTANCE as TIPC_IMPORTANCE, - TIPC_LOW_IMPORTANCE as TIPC_LOW_IMPORTANCE, - TIPC_MEDIUM_IMPORTANCE as TIPC_MEDIUM_IMPORTANCE, - TIPC_NODE_SCOPE as TIPC_NODE_SCOPE, - TIPC_PUBLISHED as TIPC_PUBLISHED, - TIPC_SRC_DROPPABLE as TIPC_SRC_DROPPABLE, - TIPC_SUB_CANCEL as TIPC_SUB_CANCEL, - TIPC_SUB_PORTS as TIPC_SUB_PORTS, - TIPC_SUB_SERVICE as TIPC_SUB_SERVICE, - TIPC_SUBSCR_TIMEOUT as TIPC_SUBSCR_TIMEOUT, - TIPC_TOP_SRV as TIPC_TOP_SRV, - TIPC_WAIT_FOREVER as TIPC_WAIT_FOREVER, - TIPC_WITHDRAWN as TIPC_WITHDRAWN, - TIPC_ZONE_SCOPE as TIPC_ZONE_SCOPE, - VM_SOCKETS_INVALID_VERSION as VM_SOCKETS_INVALID_VERSION, - VMADDR_CID_ANY as VMADDR_CID_ANY, - VMADDR_CID_HOST as VMADDR_CID_HOST, - VMADDR_PORT_ANY as VMADDR_PORT_ANY, - ) - - __all__ += [ - "ALG_OP_DECRYPT", - "ALG_OP_ENCRYPT", - "ALG_OP_SIGN", - "ALG_OP_VERIFY", - "ALG_SET_AEAD_ASSOCLEN", - "ALG_SET_AEAD_AUTHSIZE", - "ALG_SET_IV", - "ALG_SET_KEY", - "ALG_SET_OP", - "ALG_SET_PUBKEY", - "CAN_BCM", - "CAN_BCM_CAN_FD_FRAME", - "CAN_BCM_RX_ANNOUNCE_RESUME", - "CAN_BCM_RX_CHANGED", - "CAN_BCM_RX_CHECK_DLC", - "CAN_BCM_RX_DELETE", - "CAN_BCM_RX_FILTER_ID", - "CAN_BCM_RX_NO_AUTOTIMER", - "CAN_BCM_RX_READ", - "CAN_BCM_RX_RTR_FRAME", - "CAN_BCM_RX_SETUP", - "CAN_BCM_RX_STATUS", - "CAN_BCM_RX_TIMEOUT", - "CAN_BCM_SETTIMER", - "CAN_BCM_STARTTIMER", - "CAN_BCM_TX_ANNOUNCE", - "CAN_BCM_TX_COUNTEVT", - "CAN_BCM_TX_CP_CAN_ID", - "CAN_BCM_TX_DELETE", - "CAN_BCM_TX_EXPIRED", - "CAN_BCM_TX_READ", - "CAN_BCM_TX_RESET_MULTI_IDX", - "CAN_BCM_TX_SEND", - "CAN_BCM_TX_SETUP", - "CAN_BCM_TX_STATUS", - "CAN_EFF_FLAG", - "CAN_EFF_MASK", - "CAN_ERR_FLAG", - "CAN_ERR_MASK", - "CAN_ISOTP", - "CAN_RAW", - "CAN_RAW_FD_FRAMES", - "CAN_RAW_FILTER", - "CAN_RAW_LOOPBACK", - "CAN_RAW_RECV_OWN_MSGS", - "CAN_RTR_FLAG", - "CAN_SFF_MASK", - "IOCTL_VM_SOCKETS_GET_LOCAL_CID", - "NETLINK_CRYPTO", - "NETLINK_DNRTMSG", - "NETLINK_FIREWALL", - "NETLINK_IP6_FW", - "NETLINK_NFLOG", - "NETLINK_ROUTE", - "NETLINK_USERSOCK", - "NETLINK_XFRM", - "PACKET_BROADCAST", - "PACKET_FASTROUTE", - "PACKET_HOST", - "PACKET_LOOPBACK", - "PACKET_MULTICAST", - "PACKET_OTHERHOST", - "PACKET_OUTGOING", - "PF_CAN", - "PF_PACKET", - "PF_RDS", - "SO_VM_SOCKETS_BUFFER_MAX_SIZE", - "SO_VM_SOCKETS_BUFFER_MIN_SIZE", - "SO_VM_SOCKETS_BUFFER_SIZE", - "SOL_ALG", - "SOL_CAN_BASE", - "SOL_CAN_RAW", - "SOL_RDS", - "SOL_TIPC", - "TIPC_ADDR_ID", - "TIPC_ADDR_NAME", - "TIPC_ADDR_NAMESEQ", - "TIPC_CFG_SRV", - "TIPC_CLUSTER_SCOPE", - "TIPC_CONN_TIMEOUT", - "TIPC_CRITICAL_IMPORTANCE", - "TIPC_DEST_DROPPABLE", - "TIPC_HIGH_IMPORTANCE", - "TIPC_IMPORTANCE", - "TIPC_LOW_IMPORTANCE", - "TIPC_MEDIUM_IMPORTANCE", - "TIPC_NODE_SCOPE", - "TIPC_PUBLISHED", - "TIPC_SRC_DROPPABLE", - "TIPC_SUB_CANCEL", - "TIPC_SUB_PORTS", - "TIPC_SUB_SERVICE", - "TIPC_SUBSCR_TIMEOUT", - "TIPC_TOP_SRV", - "TIPC_WAIT_FOREVER", - "TIPC_WITHDRAWN", - "TIPC_ZONE_SCOPE", - "VM_SOCKETS_INVALID_VERSION", - "VMADDR_CID_ANY", - "VMADDR_CID_HOST", - "VMADDR_PORT_ANY", - "AF_CAN", - "AF_PACKET", - "AF_RDS", - "AF_TIPC", - "AF_ALG", - "AF_NETLINK", - "AF_VSOCK", - "AF_QIPCRTR", - "SOCK_CLOEXEC", - "SOCK_NONBLOCK", - ] - - if sys.version_info < (3, 11): - from _socket import CAN_RAW_ERR_FILTER as CAN_RAW_ERR_FILTER - - __all__ += ["CAN_RAW_ERR_FILTER"] - if sys.version_info >= (3, 13): - from _socket import CAN_RAW_ERR_FILTER as CAN_RAW_ERR_FILTER - - __all__ += ["CAN_RAW_ERR_FILTER"] - if sys.version_info >= (3, 15): - from _socket import ( - CAN_ISOTP_CHK_PAD_DATA as CAN_ISOTP_CHK_PAD_DATA, - CAN_ISOTP_CHK_PAD_LEN as CAN_ISOTP_CHK_PAD_LEN, - CAN_ISOTP_DEFAULT_EXT_ADDRESS as CAN_ISOTP_DEFAULT_EXT_ADDRESS, - CAN_ISOTP_DEFAULT_FLAGS as CAN_ISOTP_DEFAULT_FLAGS, - CAN_ISOTP_DEFAULT_FRAME_TXTIME as CAN_ISOTP_DEFAULT_FRAME_TXTIME, - CAN_ISOTP_DEFAULT_LL_MTU as CAN_ISOTP_DEFAULT_LL_MTU, - CAN_ISOTP_DEFAULT_LL_TX_DL as CAN_ISOTP_DEFAULT_LL_TX_DL, - CAN_ISOTP_DEFAULT_LL_TX_FLAGS as CAN_ISOTP_DEFAULT_LL_TX_FLAGS, - CAN_ISOTP_DEFAULT_PAD_CONTENT as CAN_ISOTP_DEFAULT_PAD_CONTENT, - CAN_ISOTP_DEFAULT_RECV_BS as CAN_ISOTP_DEFAULT_RECV_BS, - CAN_ISOTP_DEFAULT_RECV_STMIN as CAN_ISOTP_DEFAULT_RECV_STMIN, - CAN_ISOTP_DEFAULT_RECV_WFTMAX as CAN_ISOTP_DEFAULT_RECV_WFTMAX, - CAN_ISOTP_EXTEND_ADDR as CAN_ISOTP_EXTEND_ADDR, - CAN_ISOTP_FORCE_RXSTMIN as CAN_ISOTP_FORCE_RXSTMIN, - CAN_ISOTP_FORCE_TXSTMIN as CAN_ISOTP_FORCE_TXSTMIN, - CAN_ISOTP_HALF_DUPLEX as CAN_ISOTP_HALF_DUPLEX, - CAN_ISOTP_LISTEN_MODE as CAN_ISOTP_LISTEN_MODE, - CAN_ISOTP_LL_OPTS as CAN_ISOTP_LL_OPTS, - CAN_ISOTP_OPTS as CAN_ISOTP_OPTS, - CAN_ISOTP_RECV_FC as CAN_ISOTP_RECV_FC, - CAN_ISOTP_RX_EXT_ADDR as CAN_ISOTP_RX_EXT_ADDR, - CAN_ISOTP_RX_PADDING as CAN_ISOTP_RX_PADDING, - CAN_ISOTP_RX_STMIN as CAN_ISOTP_RX_STMIN, - CAN_ISOTP_SF_BROADCAST as CAN_ISOTP_SF_BROADCAST, - CAN_ISOTP_TX_PADDING as CAN_ISOTP_TX_PADDING, - CAN_ISOTP_TX_STMIN as CAN_ISOTP_TX_STMIN, - CAN_ISOTP_WAIT_TX_DONE as CAN_ISOTP_WAIT_TX_DONE, - SOL_CAN_ISOTP as SOL_CAN_ISOTP, - ) - - __all__ += [ - "CAN_ISOTP_CHK_PAD_DATA", - "CAN_ISOTP_CHK_PAD_LEN", - "CAN_ISOTP_DEFAULT_EXT_ADDRESS", - "CAN_ISOTP_DEFAULT_FLAGS", - "CAN_ISOTP_DEFAULT_FRAME_TXTIME", - "CAN_ISOTP_DEFAULT_LL_MTU", - "CAN_ISOTP_DEFAULT_LL_TX_DL", - "CAN_ISOTP_DEFAULT_LL_TX_FLAGS", - "CAN_ISOTP_DEFAULT_PAD_CONTENT", - "CAN_ISOTP_DEFAULT_RECV_BS", - "CAN_ISOTP_DEFAULT_RECV_STMIN", - "CAN_ISOTP_DEFAULT_RECV_WFTMAX", - "CAN_ISOTP_EXTEND_ADDR", - "CAN_ISOTP_FORCE_RXSTMIN", - "CAN_ISOTP_FORCE_TXSTMIN", - "CAN_ISOTP_HALF_DUPLEX", - "CAN_ISOTP_LL_OPTS", - "CAN_ISOTP_LISTEN_MODE", - "CAN_ISOTP_OPTS", - "CAN_ISOTP_RECV_FC", - "CAN_ISOTP_RX_EXT_ADDR", - "CAN_ISOTP_RX_PADDING", - "CAN_ISOTP_RX_STMIN", - "CAN_ISOTP_SF_BROADCAST", - "CAN_ISOTP_TX_PADDING", - "CAN_ISOTP_TX_STMIN", - "CAN_ISOTP_WAIT_TX_DONE", - "SOL_CAN_ISOTP", - ] - -if sys.platform == "linux": - from _socket import ( - CAN_J1939 as CAN_J1939, - CAN_RAW_JOIN_FILTERS as CAN_RAW_JOIN_FILTERS, - IPPROTO_UDPLITE as IPPROTO_UDPLITE, - J1939_EE_INFO_NONE as J1939_EE_INFO_NONE, - J1939_EE_INFO_TX_ABORT as J1939_EE_INFO_TX_ABORT, - J1939_FILTER_MAX as J1939_FILTER_MAX, - J1939_IDLE_ADDR as J1939_IDLE_ADDR, - J1939_MAX_UNICAST_ADDR as J1939_MAX_UNICAST_ADDR, - J1939_NLA_BYTES_ACKED as J1939_NLA_BYTES_ACKED, - J1939_NLA_PAD as J1939_NLA_PAD, - J1939_NO_ADDR as J1939_NO_ADDR, - J1939_NO_NAME as J1939_NO_NAME, - J1939_NO_PGN as J1939_NO_PGN, - J1939_PGN_ADDRESS_CLAIMED as J1939_PGN_ADDRESS_CLAIMED, - J1939_PGN_ADDRESS_COMMANDED as J1939_PGN_ADDRESS_COMMANDED, - J1939_PGN_MAX as J1939_PGN_MAX, - J1939_PGN_PDU1_MAX as J1939_PGN_PDU1_MAX, - J1939_PGN_REQUEST as J1939_PGN_REQUEST, - SCM_J1939_DEST_ADDR as SCM_J1939_DEST_ADDR, - SCM_J1939_DEST_NAME as SCM_J1939_DEST_NAME, - SCM_J1939_ERRQUEUE as SCM_J1939_ERRQUEUE, - SCM_J1939_PRIO as SCM_J1939_PRIO, - SO_J1939_ERRQUEUE as SO_J1939_ERRQUEUE, - SO_J1939_FILTER as SO_J1939_FILTER, - SO_J1939_PROMISC as SO_J1939_PROMISC, - SO_J1939_SEND_PRIO as SO_J1939_SEND_PRIO, - UDPLITE_RECV_CSCOV as UDPLITE_RECV_CSCOV, - UDPLITE_SEND_CSCOV as UDPLITE_SEND_CSCOV, - ) - - __all__ += [ - "CAN_J1939", - "CAN_RAW_JOIN_FILTERS", - "IPPROTO_UDPLITE", - "J1939_EE_INFO_NONE", - "J1939_EE_INFO_TX_ABORT", - "J1939_FILTER_MAX", - "J1939_IDLE_ADDR", - "J1939_MAX_UNICAST_ADDR", - "J1939_NLA_BYTES_ACKED", - "J1939_NLA_PAD", - "J1939_NO_ADDR", - "J1939_NO_NAME", - "J1939_NO_PGN", - "J1939_PGN_ADDRESS_CLAIMED", - "J1939_PGN_ADDRESS_COMMANDED", - "J1939_PGN_MAX", - "J1939_PGN_PDU1_MAX", - "J1939_PGN_REQUEST", - "SCM_J1939_DEST_ADDR", - "SCM_J1939_DEST_NAME", - "SCM_J1939_ERRQUEUE", - "SCM_J1939_PRIO", - "SO_J1939_ERRQUEUE", - "SO_J1939_FILTER", - "SO_J1939_PROMISC", - "SO_J1939_SEND_PRIO", - "UDPLITE_RECV_CSCOV", - "UDPLITE_SEND_CSCOV", - ] -if sys.platform == "linux": - from _socket import IPPROTO_MPTCP as IPPROTO_MPTCP - - __all__ += ["IPPROTO_MPTCP"] -if sys.platform == "linux" and sys.version_info >= (3, 11): - from _socket import SO_INCOMING_CPU as SO_INCOMING_CPU - - __all__ += ["SO_INCOMING_CPU"] -if sys.platform == "linux" and sys.version_info >= (3, 12): - from _socket import ( - TCP_CC_INFO as TCP_CC_INFO, - TCP_FASTOPEN_CONNECT as TCP_FASTOPEN_CONNECT, - TCP_FASTOPEN_KEY as TCP_FASTOPEN_KEY, - TCP_FASTOPEN_NO_COOKIE as TCP_FASTOPEN_NO_COOKIE, - TCP_INQ as TCP_INQ, - TCP_MD5SIG as TCP_MD5SIG, - TCP_MD5SIG_EXT as TCP_MD5SIG_EXT, - TCP_QUEUE_SEQ as TCP_QUEUE_SEQ, - TCP_REPAIR as TCP_REPAIR, - TCP_REPAIR_OPTIONS as TCP_REPAIR_OPTIONS, - TCP_REPAIR_QUEUE as TCP_REPAIR_QUEUE, - TCP_REPAIR_WINDOW as TCP_REPAIR_WINDOW, - TCP_SAVE_SYN as TCP_SAVE_SYN, - TCP_SAVED_SYN as TCP_SAVED_SYN, - TCP_THIN_DUPACK as TCP_THIN_DUPACK, - TCP_THIN_LINEAR_TIMEOUTS as TCP_THIN_LINEAR_TIMEOUTS, - TCP_TIMESTAMP as TCP_TIMESTAMP, - TCP_TX_DELAY as TCP_TX_DELAY, - TCP_ULP as TCP_ULP, - TCP_ZEROCOPY_RECEIVE as TCP_ZEROCOPY_RECEIVE, - ) - - __all__ += [ - "TCP_CC_INFO", - "TCP_FASTOPEN_CONNECT", - "TCP_FASTOPEN_KEY", - "TCP_FASTOPEN_NO_COOKIE", - "TCP_INQ", - "TCP_MD5SIG", - "TCP_MD5SIG_EXT", - "TCP_QUEUE_SEQ", - "TCP_REPAIR", - "TCP_REPAIR_OPTIONS", - "TCP_REPAIR_QUEUE", - "TCP_REPAIR_WINDOW", - "TCP_SAVED_SYN", - "TCP_SAVE_SYN", - "TCP_THIN_DUPACK", - "TCP_THIN_LINEAR_TIMEOUTS", - "TCP_TIMESTAMP", - "TCP_TX_DELAY", - "TCP_ULP", - "TCP_ZEROCOPY_RECEIVE", - ] - -if sys.platform == "linux" and sys.version_info >= (3, 13): - from _socket import NI_IDN as NI_IDN, SO_BINDTOIFINDEX as SO_BINDTOIFINDEX - - __all__ += ["NI_IDN", "SO_BINDTOIFINDEX"] - -if sys.version_info >= (3, 12): - from _socket import ( - IP_ADD_SOURCE_MEMBERSHIP as IP_ADD_SOURCE_MEMBERSHIP, - IP_BLOCK_SOURCE as IP_BLOCK_SOURCE, - IP_DROP_SOURCE_MEMBERSHIP as IP_DROP_SOURCE_MEMBERSHIP, - IP_PKTINFO as IP_PKTINFO, - IP_UNBLOCK_SOURCE as IP_UNBLOCK_SOURCE, - ) - - __all__ += ["IP_ADD_SOURCE_MEMBERSHIP", "IP_BLOCK_SOURCE", "IP_DROP_SOURCE_MEMBERSHIP", "IP_PKTINFO", "IP_UNBLOCK_SOURCE"] - - if sys.platform == "win32": - from _socket import ( - HV_GUID_BROADCAST as HV_GUID_BROADCAST, - HV_GUID_CHILDREN as HV_GUID_CHILDREN, - HV_GUID_LOOPBACK as HV_GUID_LOOPBACK, - HV_GUID_PARENT as HV_GUID_PARENT, - HV_GUID_WILDCARD as HV_GUID_WILDCARD, - HV_GUID_ZERO as HV_GUID_ZERO, - HV_PROTOCOL_RAW as HV_PROTOCOL_RAW, - HVSOCKET_ADDRESS_FLAG_PASSTHRU as HVSOCKET_ADDRESS_FLAG_PASSTHRU, - HVSOCKET_CONNECT_TIMEOUT as HVSOCKET_CONNECT_TIMEOUT, - HVSOCKET_CONNECT_TIMEOUT_MAX as HVSOCKET_CONNECT_TIMEOUT_MAX, - HVSOCKET_CONNECTED_SUSPEND as HVSOCKET_CONNECTED_SUSPEND, - ) - - __all__ += [ - "HV_GUID_BROADCAST", - "HV_GUID_CHILDREN", - "HV_GUID_LOOPBACK", - "HV_GUID_PARENT", - "HV_GUID_WILDCARD", - "HV_GUID_ZERO", - "HV_PROTOCOL_RAW", - "HVSOCKET_ADDRESS_FLAG_PASSTHRU", - "HVSOCKET_CONNECT_TIMEOUT", - "HVSOCKET_CONNECT_TIMEOUT_MAX", - "HVSOCKET_CONNECTED_SUSPEND", - ] - else: - from _socket import ( - ETHERTYPE_ARP as ETHERTYPE_ARP, - ETHERTYPE_IP as ETHERTYPE_IP, - ETHERTYPE_IPV6 as ETHERTYPE_IPV6, - ETHERTYPE_VLAN as ETHERTYPE_VLAN, - ) - - __all__ += ["ETHERTYPE_ARP", "ETHERTYPE_IP", "ETHERTYPE_IPV6", "ETHERTYPE_VLAN"] - - if sys.platform == "linux": - from _socket import ETH_P_ALL as ETH_P_ALL - - __all__ += ["ETH_P_ALL"] - - if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": - # FreeBSD >= 14.0 - from _socket import PF_DIVERT as PF_DIVERT - - __all__ += ["PF_DIVERT", "AF_DIVERT"] - -if sys.platform != "win32": - __all__ += ["send_fds", "recv_fds"] - -if sys.platform != "linux": - __all__ += ["AF_LINK"] -if sys.platform != "darwin" and sys.platform != "linux": - __all__ += ["AF_BLUETOOTH"] - -if sys.platform != "win32" and sys.platform != "darwin": - from _socket import BTPROTO_HCI as BTPROTO_HCI, BTPROTO_L2CAP as BTPROTO_L2CAP, BTPROTO_SCO as BTPROTO_SCO - -if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": - __all__ += ["BTPROTO_HCI", "BTPROTO_L2CAP", "BTPROTO_SCO"] - -if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": - from _socket import HCI_DATA_DIR as HCI_DATA_DIR, HCI_FILTER as HCI_FILTER, HCI_TIME_STAMP as HCI_TIME_STAMP - - __all__ += ["HCI_FILTER", "HCI_TIME_STAMP", "HCI_DATA_DIR"] - -if sys.version_info >= (3, 11) and sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": - from _socket import LOCAL_CREDS as LOCAL_CREDS, LOCAL_CREDS_PERSISTENT as LOCAL_CREDS_PERSISTENT, SCM_CREDS2 as SCM_CREDS2 - - __all__ += ["SCM_CREDS2", "LOCAL_CREDS", "LOCAL_CREDS_PERSISTENT"] - -if sys.platform == "win32" and sys.version_info >= (3, 12): - __all__ += ["AF_HYPERV"] - -if sys.platform != "win32" and sys.platform != "linux": - from _socket import ( - EAI_BADHINTS as EAI_BADHINTS, - EAI_MAX as EAI_MAX, - EAI_PROTOCOL as EAI_PROTOCOL, - IPPROTO_EON as IPPROTO_EON, - IPPROTO_HELLO as IPPROTO_HELLO, - IPPROTO_IPCOMP as IPPROTO_IPCOMP, - IPPROTO_XTP as IPPROTO_XTP, - IPV6_USE_MIN_MTU as IPV6_USE_MIN_MTU, - LOCAL_PEERCRED as LOCAL_PEERCRED, - SCM_CREDS as SCM_CREDS, - ) - - __all__ += [ - "EAI_BADHINTS", - "EAI_MAX", - "EAI_PROTOCOL", - "IPPROTO_EON", - "IPPROTO_HELLO", - "IPPROTO_IPCOMP", - "IPPROTO_XTP", - "IPV6_USE_MIN_MTU", - "LOCAL_PEERCRED", - "SCM_CREDS", - "AI_DEFAULT", - "AI_MASK", - "AI_V4MAPPED_CFG", - "MSG_EOF", - ] - -if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": - from _socket import ( - IPPROTO_BIP as IPPROTO_BIP, - IPPROTO_MOBILE as IPPROTO_MOBILE, - IPPROTO_VRRP as IPPROTO_VRRP, - MSG_BTAG as MSG_BTAG, - MSG_ETAG as MSG_ETAG, - SO_SETFIB as SO_SETFIB, - ) - - __all__ += ["SO_SETFIB", "MSG_BTAG", "MSG_ETAG", "IPPROTO_BIP", "IPPROTO_MOBILE", "IPPROTO_VRRP", "MSG_NOTIFICATION"] - -if sys.platform != "linux": - from _socket import ( - IP_RECVDSTADDR as IP_RECVDSTADDR, - IPPROTO_GGP as IPPROTO_GGP, - IPPROTO_IPV4 as IPPROTO_IPV4, - IPPROTO_MAX as IPPROTO_MAX, - IPPROTO_ND as IPPROTO_ND, - SO_USELOOPBACK as SO_USELOOPBACK, - ) - - __all__ += ["IPPROTO_GGP", "IPPROTO_IPV4", "IPPROTO_MAX", "IPPROTO_ND", "IP_RECVDSTADDR", "SO_USELOOPBACK"] - -if sys.version_info >= (3, 15): - if sys.platform == "win32" or sys.platform == "linux": - from _socket import IPV6_HDRINCL as IPV6_HDRINCL - - __all__ += ["IPV6_HDRINCL"] - -if sys.version_info >= (3, 14): - from _socket import IP_RECVTTL as IP_RECVTTL - - __all__ += ["IP_RECVTTL"] - - if sys.platform == "win32" or sys.platform == "linux": - from _socket import IP_RECVERR as IP_RECVERR, IPV6_RECVERR as IPV6_RECVERR, SO_ORIGINAL_DST as SO_ORIGINAL_DST - - __all__ += ["IP_RECVERR", "IPV6_RECVERR", "SO_ORIGINAL_DST"] - - if sys.platform == "win32": - from _socket import ( - SO_BTH_ENCRYPT as SO_BTH_ENCRYPT, - SO_BTH_MTU as SO_BTH_MTU, - SO_BTH_MTU_MAX as SO_BTH_MTU_MAX, - SO_BTH_MTU_MIN as SO_BTH_MTU_MIN, - SOL_RFCOMM as SOL_RFCOMM, - TCP_QUICKACK as TCP_QUICKACK, - ) - - __all__ += ["SOL_RFCOMM", "SO_BTH_ENCRYPT", "SO_BTH_MTU", "SO_BTH_MTU_MAX", "SO_BTH_MTU_MIN", "TCP_QUICKACK"] - - if sys.platform == "linux": - from _socket import ( - BDADDR_BREDR as BDADDR_BREDR, - BDADDR_LE_PUBLIC as BDADDR_LE_PUBLIC, - BDADDR_LE_RANDOM as BDADDR_LE_RANDOM, - BT_CHANNEL_POLICY as BT_CHANNEL_POLICY, - BT_CHANNEL_POLICY_BREDR_ONLY as BT_CHANNEL_POLICY_BREDR_ONLY, - BT_CHANNEL_POLICY_BREDR_PREFERRED as BT_CHANNEL_POLICY_BREDR_PREFERRED, - BT_CODEC as BT_CODEC, - BT_DEFER_SETUP as BT_DEFER_SETUP, - BT_FLUSHABLE as BT_FLUSHABLE, - BT_FLUSHABLE_OFF as BT_FLUSHABLE_OFF, - BT_FLUSHABLE_ON as BT_FLUSHABLE_ON, - BT_ISO_QOS as BT_ISO_QOS, - BT_MODE as BT_MODE, - BT_MODE_BASIC as BT_MODE_BASIC, - BT_MODE_ERTM as BT_MODE_ERTM, - BT_MODE_EXT_FLOWCTL as BT_MODE_EXT_FLOWCTL, - BT_MODE_LE_FLOWCTL as BT_MODE_LE_FLOWCTL, - BT_MODE_STREAMING as BT_MODE_STREAMING, - BT_PHY as BT_PHY, - BT_PHY_BR_1M_1SLOT as BT_PHY_BR_1M_1SLOT, - BT_PHY_BR_1M_3SLOT as BT_PHY_BR_1M_3SLOT, - BT_PHY_BR_1M_5SLOT as BT_PHY_BR_1M_5SLOT, - BT_PHY_EDR_2M_1SLOT as BT_PHY_EDR_2M_1SLOT, - BT_PHY_EDR_2M_3SLOT as BT_PHY_EDR_2M_3SLOT, - BT_PHY_EDR_2M_5SLOT as BT_PHY_EDR_2M_5SLOT, - BT_PHY_EDR_3M_1SLOT as BT_PHY_EDR_3M_1SLOT, - BT_PHY_EDR_3M_3SLOT as BT_PHY_EDR_3M_3SLOT, - BT_PHY_EDR_3M_5SLOT as BT_PHY_EDR_3M_5SLOT, - BT_PHY_LE_1M_RX as BT_PHY_LE_1M_RX, - BT_PHY_LE_1M_TX as BT_PHY_LE_1M_TX, - BT_PHY_LE_2M_RX as BT_PHY_LE_2M_RX, - BT_PHY_LE_2M_TX as BT_PHY_LE_2M_TX, - BT_PHY_LE_CODED_RX as BT_PHY_LE_CODED_RX, - BT_PHY_LE_CODED_TX as BT_PHY_LE_CODED_TX, - BT_PKT_STATUS as BT_PKT_STATUS, - BT_POWER as BT_POWER, - BT_POWER_FORCE_ACTIVE_OFF as BT_POWER_FORCE_ACTIVE_OFF, - BT_POWER_FORCE_ACTIVE_ON as BT_POWER_FORCE_ACTIVE_ON, - BT_RCVMTU as BT_RCVMTU, - BT_SECURITY as BT_SECURITY, - BT_SECURITY_FIPS as BT_SECURITY_FIPS, - BT_SECURITY_HIGH as BT_SECURITY_HIGH, - BT_SECURITY_LOW as BT_SECURITY_LOW, - BT_SECURITY_MEDIUM as BT_SECURITY_MEDIUM, - BT_SECURITY_SDP as BT_SECURITY_SDP, - BT_SNDMTU as BT_SNDMTU, - BT_VOICE as BT_VOICE, - BT_VOICE_CVSD_16BIT as BT_VOICE_CVSD_16BIT, - BT_VOICE_TRANSPARENT as BT_VOICE_TRANSPARENT, - BT_VOICE_TRANSPARENT_16BIT as BT_VOICE_TRANSPARENT_16BIT, - HCI_CHANNEL_CONTROL as HCI_CHANNEL_CONTROL, - HCI_CHANNEL_LOGGING as HCI_CHANNEL_LOGGING, - HCI_CHANNEL_MONITOR as HCI_CHANNEL_MONITOR, - HCI_CHANNEL_RAW as HCI_CHANNEL_RAW, - HCI_CHANNEL_USER as HCI_CHANNEL_USER, - HCI_DEV_NONE as HCI_DEV_NONE, - IP_FREEBIND as IP_FREEBIND, - IP_RECVORIGDSTADDR as IP_RECVORIGDSTADDR, - L2CAP_LM as L2CAP_LM, - L2CAP_LM_AUTH as L2CAP_LM_AUTH, - L2CAP_LM_ENCRYPT as L2CAP_LM_ENCRYPT, - L2CAP_LM_MASTER as L2CAP_LM_MASTER, - L2CAP_LM_RELIABLE as L2CAP_LM_RELIABLE, - L2CAP_LM_SECURE as L2CAP_LM_SECURE, - L2CAP_LM_TRUSTED as L2CAP_LM_TRUSTED, - SOL_BLUETOOTH as SOL_BLUETOOTH, - SOL_L2CAP as SOL_L2CAP, - SOL_RFCOMM as SOL_RFCOMM, - SOL_SCO as SOL_SCO, - VMADDR_CID_LOCAL as VMADDR_CID_LOCAL, - ) - - __all__ += ["IP_FREEBIND", "IP_RECVORIGDSTADDR", "VMADDR_CID_LOCAL"] - -# Re-exported from errno -EBADF: Final[int] -EAGAIN: Final[int] -EWOULDBLOCK: Final[int] - -# These errors are implemented in _socket at runtime -# but they consider themselves to live in socket so we'll put them here. -error = OSError - -class herror(error): ... -class gaierror(error): ... - -timeout = TimeoutError - -class AddressFamily(IntEnum): - AF_INET = 2 - AF_INET6 = 10 - AF_APPLETALK = 5 - AF_IPX = 4 - AF_SNA = 22 - AF_UNSPEC = 0 - if sys.platform != "darwin": - AF_IRDA = 23 - if sys.platform != "win32": - AF_ROUTE = 16 - AF_UNIX = 1 - if sys.platform == "darwin": - AF_SYSTEM = 32 - if sys.platform != "win32" and sys.platform != "darwin": - AF_ASH = 18 - AF_ATMPVC = 8 - AF_ATMSVC = 20 - AF_AX25 = 3 - AF_BRIDGE = 7 - AF_ECONET = 19 - AF_KEY = 15 - AF_LLC = 26 - AF_NETBEUI = 13 - AF_NETROM = 6 - AF_PPPOX = 24 - AF_ROSE = 11 - AF_SECURITY = 14 - AF_WANPIPE = 25 - AF_X25 = 9 - if sys.platform == "linux": - AF_CAN = 29 - AF_PACKET = 17 - AF_RDS = 21 - AF_TIPC = 30 - AF_ALG = 38 - AF_NETLINK = 16 - AF_VSOCK = 40 - AF_QIPCRTR = 42 - if sys.platform != "linux": - AF_LINK = 33 - if sys.platform != "darwin": - AF_BLUETOOTH = 32 - if sys.platform == "win32" and sys.version_info >= (3, 12): - AF_HYPERV = 34 - if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12): - # FreeBSD >= 14.0 - AF_DIVERT = 44 - -AF_INET: Final = AddressFamily.AF_INET -AF_INET6: Final = AddressFamily.AF_INET6 -AF_APPLETALK: Final = AddressFamily.AF_APPLETALK -AF_DECnet: Final = 12 -AF_IPX: Final = AddressFamily.AF_IPX -AF_SNA: Final = AddressFamily.AF_SNA -AF_UNSPEC: Final = AddressFamily.AF_UNSPEC - -if sys.platform != "darwin": - AF_IRDA: Final = AddressFamily.AF_IRDA - -if sys.platform != "win32": - AF_ROUTE: Final = AddressFamily.AF_ROUTE - AF_UNIX: Final = AddressFamily.AF_UNIX - -if sys.platform == "darwin": - AF_SYSTEM: Final = AddressFamily.AF_SYSTEM - -if sys.platform != "win32" and sys.platform != "darwin": - AF_ASH: Final = AddressFamily.AF_ASH - AF_ATMPVC: Final = AddressFamily.AF_ATMPVC - AF_ATMSVC: Final = AddressFamily.AF_ATMSVC - AF_AX25: Final = AddressFamily.AF_AX25 - AF_BRIDGE: Final = AddressFamily.AF_BRIDGE - AF_ECONET: Final = AddressFamily.AF_ECONET - AF_KEY: Final = AddressFamily.AF_KEY - AF_LLC: Final = AddressFamily.AF_LLC - AF_NETBEUI: Final = AddressFamily.AF_NETBEUI - AF_NETROM: Final = AddressFamily.AF_NETROM - AF_PPPOX: Final = AddressFamily.AF_PPPOX - AF_ROSE: Final = AddressFamily.AF_ROSE - AF_SECURITY: Final = AddressFamily.AF_SECURITY - AF_WANPIPE: Final = AddressFamily.AF_WANPIPE - AF_X25: Final = AddressFamily.AF_X25 - -if sys.platform == "linux": - AF_CAN: Final = AddressFamily.AF_CAN - AF_PACKET: Final = AddressFamily.AF_PACKET - AF_RDS: Final = AddressFamily.AF_RDS - AF_TIPC: Final = AddressFamily.AF_TIPC - AF_ALG: Final = AddressFamily.AF_ALG - AF_NETLINK: Final = AddressFamily.AF_NETLINK - AF_VSOCK: Final = AddressFamily.AF_VSOCK - AF_QIPCRTR: Final = AddressFamily.AF_QIPCRTR - -if sys.platform != "linux": - AF_LINK: Final = AddressFamily.AF_LINK -if sys.platform != "darwin": - AF_BLUETOOTH: Final = AddressFamily.AF_BLUETOOTH -if sys.platform == "win32" and sys.version_info >= (3, 12): - AF_HYPERV: Final = AddressFamily.AF_HYPERV -if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12): - # FreeBSD >= 14.0 - AF_DIVERT: Final = AddressFamily.AF_DIVERT - -class SocketKind(IntEnum): - SOCK_STREAM = 1 - SOCK_DGRAM = 2 - SOCK_RAW = 3 - SOCK_RDM = 4 - SOCK_SEQPACKET = 5 - if sys.platform == "linux": - SOCK_CLOEXEC = 524288 - SOCK_NONBLOCK = 2048 - -SOCK_STREAM: Final = SocketKind.SOCK_STREAM -SOCK_DGRAM: Final = SocketKind.SOCK_DGRAM -SOCK_RAW: Final = SocketKind.SOCK_RAW -SOCK_RDM: Final = SocketKind.SOCK_RDM -SOCK_SEQPACKET: Final = SocketKind.SOCK_SEQPACKET -if sys.platform == "linux": - SOCK_CLOEXEC: Final = SocketKind.SOCK_CLOEXEC - SOCK_NONBLOCK: Final = SocketKind.SOCK_NONBLOCK - -class MsgFlag(IntFlag): - MSG_CTRUNC = 8 - MSG_DONTROUTE = 4 - MSG_OOB = 1 - MSG_PEEK = 2 - MSG_TRUNC = 32 - MSG_WAITALL = 256 - if sys.platform == "win32": - MSG_BCAST = 1024 - MSG_MCAST = 2048 - - if sys.platform != "darwin": - MSG_ERRQUEUE = 8192 - - if sys.platform != "win32" and sys.platform != "darwin": - MSG_CMSG_CLOEXEC = 1073741821 - MSG_CONFIRM = 2048 - MSG_FASTOPEN = 536870912 - MSG_MORE = 32768 - - if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": - MSG_NOTIFICATION = 8192 - - if sys.platform != "win32": - MSG_DONTWAIT = 64 - MSG_EOR = 128 - MSG_NOSIGNAL = 16384 # sometimes this exists on darwin, sometimes not - if sys.platform != "win32" and sys.platform != "linux": - MSG_EOF = 256 - -MSG_CTRUNC: Final = MsgFlag.MSG_CTRUNC -MSG_DONTROUTE: Final = MsgFlag.MSG_DONTROUTE -MSG_OOB: Final = MsgFlag.MSG_OOB -MSG_PEEK: Final = MsgFlag.MSG_PEEK -MSG_TRUNC: Final = MsgFlag.MSG_TRUNC -MSG_WAITALL: Final = MsgFlag.MSG_WAITALL - -if sys.platform == "win32": - MSG_BCAST: Final = MsgFlag.MSG_BCAST - MSG_MCAST: Final = MsgFlag.MSG_MCAST - -if sys.platform != "darwin": - MSG_ERRQUEUE: Final = MsgFlag.MSG_ERRQUEUE - -if sys.platform != "win32": - MSG_DONTWAIT: Final = MsgFlag.MSG_DONTWAIT - MSG_EOR: Final = MsgFlag.MSG_EOR - MSG_NOSIGNAL: Final = MsgFlag.MSG_NOSIGNAL # Sometimes this exists on darwin, sometimes not - -if sys.platform != "win32" and sys.platform != "darwin": - MSG_CMSG_CLOEXEC: Final = MsgFlag.MSG_CMSG_CLOEXEC - MSG_CONFIRM: Final = MsgFlag.MSG_CONFIRM - MSG_FASTOPEN: Final = MsgFlag.MSG_FASTOPEN - MSG_MORE: Final = MsgFlag.MSG_MORE - -if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": - MSG_NOTIFICATION: Final = MsgFlag.MSG_NOTIFICATION - -if sys.platform != "win32" and sys.platform != "linux": - MSG_EOF: Final = MsgFlag.MSG_EOF - -class AddressInfo(IntFlag): - AI_ADDRCONFIG = 32 - AI_ALL = 16 - AI_CANONNAME = 2 - AI_NUMERICHOST = 4 - AI_NUMERICSERV = 1024 - AI_PASSIVE = 1 - AI_V4MAPPED = 8 - if sys.platform != "win32" and sys.platform != "linux": - AI_DEFAULT = 1536 - AI_MASK = 5127 - AI_V4MAPPED_CFG = 512 - -AI_ADDRCONFIG: Final = AddressInfo.AI_ADDRCONFIG -AI_ALL: Final = AddressInfo.AI_ALL -AI_CANONNAME: Final = AddressInfo.AI_CANONNAME -AI_NUMERICHOST: Final = AddressInfo.AI_NUMERICHOST -AI_NUMERICSERV: Final = AddressInfo.AI_NUMERICSERV -AI_PASSIVE: Final = AddressInfo.AI_PASSIVE -AI_V4MAPPED: Final = AddressInfo.AI_V4MAPPED - -if sys.platform != "win32" and sys.platform != "linux": - AI_DEFAULT: Final = AddressInfo.AI_DEFAULT - AI_MASK: Final = AddressInfo.AI_MASK - AI_V4MAPPED_CFG: Final = AddressInfo.AI_V4MAPPED_CFG - -if sys.platform == "win32": - errorTab: dict[int, str] # undocumented - -@type_check_only -class _SendableFile(Protocol): - def read(self, size: int, /) -> bytes: ... - def seek(self, offset: int, /) -> object: ... - - # optional fields: - # - # @property - # def mode(self) -> str: ... - # def fileno(self) -> int: ... - -class socket(_socket.socket): - __slots__ = ["__weakref__", "_io_refs", "_closed"] - def __init__( - self, family: AddressFamily | int = -1, type: SocketKind | int = -1, proto: int = -1, fileno: int | None = None - ) -> None: ... - def __enter__(self) -> Self: ... - def __exit__(self, *args: Unused) -> None: ... - def dup(self) -> Self: ... - def accept(self) -> tuple[socket, _RetAddress]: ... - - # Note that the makefile's documented windows-specific behavior is not represented - # mode strings with duplicates are intentionally excluded - @overload - def makefile( - self, - mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"], - buffering: Literal[0], - *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - ) -> SocketIO: ... - @overload - def makefile( - self, - mode: Literal["rwb", "rbw", "wrb", "wbr", "brw", "bwr"], - buffering: Literal[-1, 1] | None = None, - *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - ) -> BufferedRWPair: ... - @overload - def makefile( - self, - mode: Literal["rb", "br"], - buffering: Literal[-1, 1] | None = None, - *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - ) -> BufferedReader: ... - @overload - def makefile( - self, - mode: Literal["wb", "bw"], - buffering: Literal[-1, 1] | None = None, - *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - ) -> BufferedWriter: ... - @overload - def makefile( - self, - mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"], - buffering: int, - *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - ) -> IOBase: ... - @overload - def makefile( - self, - mode: Literal["r", "w", "rw", "wr", ""] = "r", - buffering: int | None = None, - *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - ) -> TextIOWrapper: ... - - def sendfile(self, file: _SendableFile, offset: int = 0, count: int | None = None) -> int: ... - @property - def family(self) -> AddressFamily: ... - @property - def type(self) -> SocketKind: ... - def get_inheritable(self) -> bool: ... - def set_inheritable(self, inheritable: bool) -> None: ... - -def fromfd(fd: SupportsIndex, family: AddressFamily | int, type: SocketKind | int, proto: int = 0) -> socket: ... - -if sys.platform != "win32": - def send_fds( - sock: socket, buffers: Iterable[ReadableBuffer], fds: Iterable[int], flags: Unused = 0, address: Unused = None - ) -> int: ... - def recv_fds(sock: socket, bufsize: int, maxfds: int, flags: int = 0) -> tuple[bytes, list[int], int, Any]: ... - -if sys.platform == "win32": - def fromshare(info: bytes) -> socket: ... - -if sys.platform == "win32": - def socketpair(family: int = ..., type: int = ..., proto: int = 0) -> tuple[socket, socket]: ... - -else: - def socketpair( - family: int | AddressFamily | None = None, type: SocketKind | int = ..., proto: int = 0 - ) -> tuple[socket, socket]: ... - -class SocketIO(RawIOBase): - def __init__(self, sock: socket, mode: Literal["r", "w", "rw", "rb", "wb", "rwb"]) -> None: ... - def readinto(self, b: WriteableBuffer) -> int | None: ... - def write(self, b: ReadableBuffer) -> int | None: ... - @property - def name(self) -> int: ... # return value is really "int" - @property - def mode(self) -> Literal["rb", "wb", "rwb"]: ... - -def getfqdn(name: str = "") -> str: ... - -if sys.version_info >= (3, 11): - def create_connection( - address: tuple[str | None, bytes | str | int | None], - timeout: float | None = ..., - source_address: _Address | None = None, - *, - all_errors: bool = False, - ) -> socket: ... - -else: - def create_connection( - address: tuple[str | None, int], timeout: float | None = ..., source_address: _Address | None = None - ) -> socket: ... - -def has_dualstack_ipv6() -> bool: ... -def create_server( - address: _Address, *, family: int = ..., backlog: int | None = None, reuse_port: bool = False, dualstack_ipv6: bool = False -) -> socket: ... - -# The 5th tuple item is the socket address, for IP4, IP6, or IP6 if Python is compiled with --disable-ipv6, respectively. -def getaddrinfo( - host: bytes | str | None, port: bytes | str | int | None, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0 -) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]: ... diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/string/__init__.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/string/__init__.vpi deleted file mode 100644 index df70cdc6..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/string/__init__.vpi +++ /dev/null @@ -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: ... diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/string/templatelib.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/string/templatelib.vpi deleted file mode 100644 index ee901cdc..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/string/templatelib.vpi +++ /dev/null @@ -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: ... diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/subprocess.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/subprocess.vpi deleted file mode 100644 index c191f0e3..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/subprocess.vpi +++ /dev/null @@ -1,1484 +0,0 @@ -import sys -from _typeshed import MaybeNone, ReadableBuffer, StrOrBytesPath -from collections.abc import Callable, Collection, Iterable, Mapping, Sequence -from types import GenericAlias, TracebackType -from typing import IO, Any, AnyStr, Final, Generic, Literal, TypeAlias, TypeVar, overload -from typing_extensions import Self - -__all__ = [ - "Popen", - "PIPE", - "STDOUT", - "call", - "check_call", - "getstatusoutput", - "getoutput", - "check_output", - "run", - "CalledProcessError", - "DEVNULL", - "SubprocessError", - "TimeoutExpired", - "CompletedProcess", -] - -if sys.platform == "win32": - __all__ += [ - "CREATE_NEW_CONSOLE", - "CREATE_NEW_PROCESS_GROUP", - "STARTF_USESHOWWINDOW", - "STARTF_USESTDHANDLES", - "STARTUPINFO", - "STD_ERROR_HANDLE", - "STD_INPUT_HANDLE", - "STD_OUTPUT_HANDLE", - "SW_HIDE", - "ABOVE_NORMAL_PRIORITY_CLASS", - "BELOW_NORMAL_PRIORITY_CLASS", - "CREATE_BREAKAWAY_FROM_JOB", - "CREATE_DEFAULT_ERROR_MODE", - "CREATE_NO_WINDOW", - "DETACHED_PROCESS", - "HIGH_PRIORITY_CLASS", - "IDLE_PRIORITY_CLASS", - "NORMAL_PRIORITY_CLASS", - "REALTIME_PRIORITY_CLASS", - ] - -# We prefer to annotate inputs to methods (eg subprocess.check_call) with these -# union types. -# For outputs we use laborious literal based overloads to try to determine -# which specific return types to use, and prefer to fall back to Any when -# this does not work, so the caller does not have to use an assertion to confirm -# which type. -# -# For example: -# -# try: -# x = subprocess.check_output(["ls", "-l"]) -# reveal_type(x) # bytes, based on the overloads -# except TimeoutError as e: -# reveal_type(e.cmd) # Any, but morally is _CMD -_FILE: TypeAlias = None | int | IO[Any] -_InputString: TypeAlias = ReadableBuffer | str -_CMD: TypeAlias = StrOrBytesPath | Sequence[StrOrBytesPath] -if sys.platform == "win32": - _ENV: TypeAlias = Mapping[str, str] -else: - _ENV: TypeAlias = Mapping[bytes, StrOrBytesPath] | Mapping[str, StrOrBytesPath] - -_T = TypeVar("_T") - -# These two are private but documented -if sys.version_info >= (3, 11): - _USE_VFORK: Final[bool] -_USE_POSIX_SPAWN: Final[bool] - -class CompletedProcess(Generic[_T]): - # morally: _CMD - args: Any - returncode: int - # These can both be None, but requiring checks for None would be tedious - # and writing all the overloads would be horrific. - stdout: _T - stderr: _T - def __init__(self, args: _CMD, returncode: int, stdout: _T | None = None, stderr: _T | None = None) -> None: ... - def check_returncode(self) -> None: ... - def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... - -if sys.version_info >= (3, 11): - # 3.11 adds "process_group" argument - @overload # text is True - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[True] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: str | None = None, - errors: str | None = None, - input: str | None = None, - text: Literal[True], - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> CompletedProcess[str]: ... - @overload # encoding is str - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: str, - errors: str | None = None, - input: str | None = None, - text: bool | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> CompletedProcess[str]: ... - @overload # errors is str - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: str | None = None, - errors: str, - input: str | None = None, - text: bool | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> CompletedProcess[str]: ... - @overload # universal_newlines is True - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - *, - universal_newlines: Literal[True], - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - # where the *real* keyword only args start - capture_output: bool = False, - check: bool = False, - encoding: str | None = None, - errors: str | None = None, - input: str | None = None, - text: Literal[True] | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> CompletedProcess[str]: ... - @overload # universal_newlines and text are False, None, or missing - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[False] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: None = None, - errors: None = None, - input: ReadableBuffer | None = None, - text: Literal[False] | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> CompletedProcess[bytes]: ... - @overload # fallback - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: str | None = None, - errors: str | None = None, - input: _InputString | None = None, - text: bool | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> CompletedProcess[Any]: ... -else: - # 3.10 adds "pipesize" argument - @overload # text is True - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[True] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: str | None = None, - errors: str | None = None, - input: str | None = None, - text: Literal[True], - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> CompletedProcess[str]: ... - @overload # encoding is str - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: str, - errors: str | None = None, - input: str | None = None, - text: bool | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> CompletedProcess[str]: ... - @overload # errors is str - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: str | None = None, - errors: str, - input: str | None = None, - text: bool | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> CompletedProcess[str]: ... - @overload # universal_newlines is True - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - *, - universal_newlines: Literal[True], - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - # where the *real* keyword only args start - capture_output: bool = False, - check: bool = False, - encoding: str | None = None, - errors: str | None = None, - input: str | None = None, - text: Literal[True] | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> CompletedProcess[str]: ... - @overload # universal_newlines and text are False, None, or missing - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[False] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: None = None, - errors: None = None, - input: ReadableBuffer | None = None, - text: Literal[False] | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> CompletedProcess[bytes]: ... - @overload # fallback - def run( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - capture_output: bool = False, - check: bool = False, - encoding: str | None = None, - errors: str | None = None, - input: _InputString | None = None, - text: bool | None = None, - timeout: float | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> CompletedProcess[Any]: ... - -# Same args as Popen.__init__ -if sys.version_info >= (3, 11): - # 3.11 adds "process_group" argument - def call( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - encoding: str | None = None, - timeout: float | None = None, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> int: ... - -else: - # 3.10 adds "pipesize" argument - def call( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - encoding: str | None = None, - timeout: float | None = None, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> int: ... - -# Same args as Popen.__init__ -if sys.version_info >= (3, 11): - # 3.11 adds "process_group" argument - def check_call( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - timeout: float | None = None, - *, - encoding: str | None = None, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> int: ... - -else: - # 3.10 adds "pipesize" argument - def check_call( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stdout: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - timeout: float | None = None, - *, - encoding: str | None = None, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> int: ... - -if sys.version_info >= (3, 11): - # 3.11 adds "process_group" argument - @overload # text is True - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[True] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: str | None = None, - errors: str | None = None, - text: Literal[True], - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> str: ... - @overload # encoding is str - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: str, - errors: str | None = None, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> str: ... - @overload # errors is str - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: str | None = None, - errors: str, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> str: ... - @overload # universal_newlines is True - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - *, - universal_newlines: Literal[True], - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - # where the real keyword only ones start - timeout: float | None = None, - input: _InputString | None = None, - encoding: str | None = None, - errors: str | None = None, - text: Literal[True] | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> str: ... - @overload # universal_newlines and text are False, None, or missing - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[False] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: None = None, - errors: None = None, - text: Literal[False] | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> bytes: ... - @overload # fallback - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: str | None = None, - errors: str | None = None, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> Any: ... # morally: -> str | bytes -else: - # 3.10 adds "pipesize" argument - @overload # text is True - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[True] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: str | None = None, - errors: str | None = None, - text: Literal[True], - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> str: ... - @overload # encoding is str - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: str, - errors: str | None = None, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> str: ... - @overload # errors is str - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: str | None = None, - errors: str, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> str: ... - @overload # universal_newlines is True - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - *, - universal_newlines: Literal[True], - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - # where the real keyword only ones start - timeout: float | None = None, - input: _InputString | None = None, - encoding: str | None = None, - errors: str | None = None, - text: Literal[True] | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> str: ... - @overload # universal_newlines and text are False, None, or missing - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[False] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: None = None, - errors: None = None, - text: Literal[False] | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> bytes: ... - @overload # fallback - def check_output( - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE = None, - stderr: _FILE = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - timeout: float | None = None, - input: _InputString | None = None, - encoding: str | None = None, - errors: str | None = None, - text: bool | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> Any: ... # morally: -> str | bytes - -PIPE: Final[int] -STDOUT: Final[int] -DEVNULL: Final[int] - -class SubprocessError(Exception): ... - -class TimeoutExpired(SubprocessError): - def __init__( - self, cmd: _CMD, timeout: float, output: str | bytes | None = None, stderr: str | bytes | None = None - ) -> None: ... - # morally: _CMD - cmd: Any - timeout: float - # morally: str | bytes | None - output: Any - stdout: bytes | None - stderr: bytes | None - -class CalledProcessError(SubprocessError): - returncode: int - # morally: _CMD - cmd: Any - # morally: str | bytes | None - output: Any - - # morally: str | bytes | None - stdout: Any - stderr: Any - def __init__( - self, returncode: int, cmd: _CMD, output: str | bytes | None = None, stderr: str | bytes | None = None - ) -> None: ... - -class Popen(Generic[AnyStr]): - args: _CMD - stdin: IO[Any] | None - stdout: IO[Any] | None - stderr: IO[Any] | None - pid: int - returncode: int | MaybeNone - universal_newlines: bool - - if sys.version_info >= (3, 11): - # process_group is added in 3.11 - @overload # encoding is str - def __init__( - self: Popen[str], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: bool | None = None, - encoding: str, - errors: str | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> None: ... - @overload # errors is str - def __init__( - self: Popen[str], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: bool | None = None, - encoding: str | None = None, - errors: str, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> None: ... - @overload # universal_newlines is True - def __init__( - self: Popen[str], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - *, - universal_newlines: Literal[True], - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - # where the *real* keyword only args start - text: bool | None = None, - encoding: str | None = None, - errors: str | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> None: ... - @overload # text is True - def __init__( - self: Popen[str], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[True] | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: Literal[True], - encoding: str | None = None, - errors: str | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> None: ... - @overload # universal_newlines and text are False, None, or missing - def __init__( - self: Popen[bytes], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[False] | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: Literal[False] | None = None, - encoding: None = None, - errors: None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> None: ... - @overload # fallback - def __init__( - self: Popen[Any], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: bool | None = None, - encoding: str | None = None, - errors: str | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - process_group: int | None = None, - ) -> None: ... - else: - # pipesize is added in 3.10 - @overload # encoding is str - def __init__( - self: Popen[str], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: bool | None = None, - encoding: str, - errors: str | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> None: ... - @overload # errors is str - def __init__( - self: Popen[str], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: bool | None = None, - encoding: str | None = None, - errors: str, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> None: ... - @overload # universal_newlines is True - def __init__( - self: Popen[str], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - *, - universal_newlines: Literal[True], - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - # where the *real* keyword only args start - text: bool | None = None, - encoding: str | None = None, - errors: str | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> None: ... - @overload # text is True - def __init__( - self: Popen[str], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[True] | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: Literal[True], - encoding: str | None = None, - errors: str | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> None: ... - @overload # universal_newlines and text are False, None, or missing - def __init__( - self: Popen[bytes], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: Literal[False] | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: Literal[False] | None = None, - encoding: None = None, - errors: None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> None: ... - @overload # fallback - def __init__( - self: Popen[Any], - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: bool | None = None, - encoding: str | None = None, - errors: str | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> None: ... - - def poll(self) -> int | None: ... - def wait(self, timeout: float | None = None) -> int: ... - # morally the members of the returned tuple should be optional - # TODO: this should allow ReadableBuffer for Popen[bytes], but adding - # overloads for that runs into a mypy bug (python/mypy#14070). - def communicate(self, input: AnyStr | None = None, timeout: float | None = None) -> tuple[AnyStr, AnyStr]: ... - def send_signal(self, sig: int) -> None: ... - def terminate(self) -> None: ... - def kill(self) -> None: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __del__(self) -> None: ... - def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... - -# The result really is always a str. -if sys.version_info >= (3, 11): - def getstatusoutput(cmd: _CMD, *, encoding: str | None = None, errors: str | None = None) -> tuple[int, str]: ... - def getoutput(cmd: _CMD, *, encoding: str | None = None, errors: str | None = None) -> str: ... - -else: - def getstatusoutput(cmd: _CMD) -> tuple[int, str]: ... - def getoutput(cmd: _CMD) -> str: ... - -def list2cmdline(seq: Iterable[StrOrBytesPath]) -> str: ... # undocumented - -if sys.platform == "win32": - if sys.version_info >= (3, 13): - from _winapi import STARTF_FORCEOFFFEEDBACK, STARTF_FORCEONFEEDBACK - - __all__ += ["STARTF_FORCEOFFFEEDBACK", "STARTF_FORCEONFEEDBACK"] - - class STARTUPINFO: - def __init__( - self, - *, - dwFlags: int = 0, - hStdInput: Any | None = None, - hStdOutput: Any | None = None, - hStdError: Any | None = None, - wShowWindow: int = 0, - lpAttributeList: Mapping[str, Any] | None = None, - ) -> None: ... - dwFlags: int - hStdInput: Any | None - hStdOutput: Any | None - hStdError: Any | None - wShowWindow: int - lpAttributeList: Mapping[str, Any] - def copy(self) -> STARTUPINFO: ... - - from _winapi import ( - ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS, - BELOW_NORMAL_PRIORITY_CLASS as BELOW_NORMAL_PRIORITY_CLASS, - CREATE_BREAKAWAY_FROM_JOB as CREATE_BREAKAWAY_FROM_JOB, - CREATE_DEFAULT_ERROR_MODE as CREATE_DEFAULT_ERROR_MODE, - CREATE_NEW_CONSOLE as CREATE_NEW_CONSOLE, - CREATE_NEW_PROCESS_GROUP as CREATE_NEW_PROCESS_GROUP, - CREATE_NO_WINDOW as CREATE_NO_WINDOW, - DETACHED_PROCESS as DETACHED_PROCESS, - HIGH_PRIORITY_CLASS as HIGH_PRIORITY_CLASS, - IDLE_PRIORITY_CLASS as IDLE_PRIORITY_CLASS, - NORMAL_PRIORITY_CLASS as NORMAL_PRIORITY_CLASS, - REALTIME_PRIORITY_CLASS as REALTIME_PRIORITY_CLASS, - STARTF_USESHOWWINDOW as STARTF_USESHOWWINDOW, - STARTF_USESTDHANDLES as STARTF_USESTDHANDLES, - STD_ERROR_HANDLE as STD_ERROR_HANDLE, - STD_INPUT_HANDLE as STD_INPUT_HANDLE, - STD_OUTPUT_HANDLE as STD_OUTPUT_HANDLE, - SW_HIDE as SW_HIDE, - ) diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/sys/__init__.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/sys/__init__.vpi deleted file mode 100644 index 72e894b9..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/sys/__init__.vpi +++ /dev/null @@ -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 diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/sys/__jit.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/sys/__jit.vpi deleted file mode 100644 index 90fb65c1..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/sys/__jit.vpi +++ /dev/null @@ -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: ... diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/sys/_monitoring.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/sys/_monitoring.vpi deleted file mode 100644 index b999d63f..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/sys/_monitoring.vpi +++ /dev/null @@ -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: ... diff --git a/packages/vipeye-internal/typeshed-fallback/stdlib/this.vpi b/packages/vipeye-internal/typeshed-fallback/stdlib/this.vpi deleted file mode 100644 index 8de996b0..00000000 --- a/packages/vipeye-internal/typeshed-fallback/stdlib/this.vpi +++ /dev/null @@ -1,2 +0,0 @@ -s: str -d: dict[str, str]