mirror of
https://github.com/microsoft/pyright.git
synced 2025-12-23 09:19:29 +00:00
Merge branch 'main' into pull-pylance-with-pyright-1.1.407-20251024-224406
This commit is contained in:
commit
84517fff23
189 changed files with 1826 additions and 873 deletions
|
|
@ -246,7 +246,7 @@ extends:
|
|||
- task: ManualValidation@0
|
||||
timeoutInMinutes: 120 # task times out in 2 hours
|
||||
inputs:
|
||||
notifyUsers: 'plseng@microsoft.com,eric@traut.com,rchiodo@microsoft.com,bschnurr@microsoft.com,graham.wheeler@microsoft.com'
|
||||
notifyUsers: '[DevDiv]\Python.Language Server,eric@traut.com'
|
||||
instructions: 'In the next 2 hours please test the latest draft release of Pyright, then Publish the release in GitHub.'
|
||||
onTimeout: 'reject' # require sign-off
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "1.1.406",
|
||||
"version": "1.1.407",
|
||||
"command": {
|
||||
"version": {
|
||||
"push": false,
|
||||
|
|
|
|||
25
package-lock.json
generated
25
package-lock.json
generated
|
|
@ -3778,31 +3778,6 @@
|
|||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encoding": {
|
||||
"version": "0.1.13",
|
||||
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
|
||||
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"iconv-lite": "^0.6.2"
|
||||
}
|
||||
},
|
||||
"node_modules/encoding/node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/end-of-stream": {
|
||||
"version": "1.4.5",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
|
||||
|
|
|
|||
4
packages/pyright-internal/package-lock.json
generated
4
packages/pyright-internal/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pyright-internal",
|
||||
"version": "1.1.406",
|
||||
"version": "1.1.407",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pyright-internal",
|
||||
"version": "1.1.406",
|
||||
"version": "1.1.407",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@yarnpkg/fslib": "2.10.4",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "pyright-internal",
|
||||
"displayName": "pyright",
|
||||
"description": "Type checker for the Python language",
|
||||
"version": "1.1.406",
|
||||
"version": "1.1.407",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"files": [
|
||||
|
|
|
|||
|
|
@ -6337,6 +6337,12 @@ export class Checker extends ParseTreeWalker {
|
|||
type: this._evaluator.printType(entry.valueType),
|
||||
})
|
||||
);
|
||||
} else if (!baseTypedDictEntries.extraItems.isReadOnly && entry.isReadOnly) {
|
||||
diag.addMessage(
|
||||
LocAddendum.typedDictClosedFieldNotReadOnly().format({
|
||||
name,
|
||||
})
|
||||
);
|
||||
} else if (!baseTypedDictEntries.extraItems.isReadOnly && entry.isRequired) {
|
||||
diag.addMessage(
|
||||
LocAddendum.typedDictClosedFieldNotRequired().format({
|
||||
|
|
|
|||
|
|
@ -325,6 +325,28 @@ export function applyClassDecorator(
|
|||
}
|
||||
}
|
||||
|
||||
const applyDataclassTransform = (): void => {
|
||||
// Is this a dataclass decorator?
|
||||
let dataclassBehaviors: DataClassBehaviors | undefined;
|
||||
let callNode: CallNode | undefined;
|
||||
|
||||
if (decoratorNode.d.expr.nodeType === ParseNodeType.Call) {
|
||||
callNode = decoratorNode.d.expr;
|
||||
const decoratorCallType = evaluator.getTypeOfExpression(
|
||||
callNode.d.leftExpr,
|
||||
flags | EvalFlags.CallBaseDefaults
|
||||
).type;
|
||||
dataclassBehaviors = getDataclassDecoratorBehaviors(decoratorCallType);
|
||||
} else {
|
||||
const decoratorType = evaluator.getTypeOfExpression(decoratorNode.d.expr, flags).type;
|
||||
dataclassBehaviors = getDataclassDecoratorBehaviors(decoratorType);
|
||||
}
|
||||
|
||||
if (dataclassBehaviors) {
|
||||
applyDataClassDecorator(evaluator, decoratorNode, originalClassType, dataclassBehaviors, callNode);
|
||||
}
|
||||
};
|
||||
|
||||
if (isOverloaded(decoratorType)) {
|
||||
const dataclassBehaviors = getDataclassDecoratorBehaviors(decoratorType);
|
||||
if (dataclassBehaviors) {
|
||||
|
|
@ -361,31 +383,14 @@ export function applyClassDecorator(
|
|||
return inputClassType;
|
||||
}
|
||||
|
||||
// Is this a dataclass decorator?
|
||||
let dataclassBehaviors: DataClassBehaviors | undefined;
|
||||
let callNode: CallNode | undefined;
|
||||
|
||||
if (decoratorNode.d.expr.nodeType === ParseNodeType.Call) {
|
||||
callNode = decoratorNode.d.expr;
|
||||
const decoratorCallType = evaluator.getTypeOfExpression(
|
||||
callNode.d.leftExpr,
|
||||
flags | EvalFlags.CallBaseDefaults
|
||||
).type;
|
||||
dataclassBehaviors = getDataclassDecoratorBehaviors(decoratorCallType);
|
||||
} else {
|
||||
const decoratorType = evaluator.getTypeOfExpression(decoratorNode.d.expr, flags).type;
|
||||
dataclassBehaviors = getDataclassDecoratorBehaviors(decoratorType);
|
||||
}
|
||||
|
||||
if (dataclassBehaviors) {
|
||||
applyDataClassDecorator(evaluator, decoratorNode, originalClassType, dataclassBehaviors, callNode);
|
||||
return inputClassType;
|
||||
}
|
||||
applyDataclassTransform();
|
||||
} else if (isClassInstance(decoratorType)) {
|
||||
if (ClassType.isBuiltIn(decoratorType, 'deprecated')) {
|
||||
originalClassType.shared.deprecatedMessage = decoratorType.priv.deprecatedInstanceMessage;
|
||||
return inputClassType;
|
||||
}
|
||||
|
||||
applyDataclassTransform();
|
||||
}
|
||||
|
||||
return getTypeOfDecorator(evaluator, decoratorNode, inputClassType);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { DiagnosticRule } from '../common/diagnosticRules';
|
|||
import { convertOffsetsToRange } from '../common/positionUtils';
|
||||
import { TextRange } from '../common/textRange';
|
||||
import { LocMessage } from '../localization/localize';
|
||||
import { ArgCategory, ExpressionNode, ParamCategory, ParseNodeType, StringListNode } from '../parser/parseNodes';
|
||||
import { ArgCategory, ExpressionNode, ParamCategory, ParseNodeType } from '../parser/parseNodes';
|
||||
import { Tokenizer } from '../parser/tokenizer';
|
||||
import { getFileInfo } from './analyzerNodeInfo';
|
||||
import { DeclarationType, VariableDeclaration } from './declaration';
|
||||
|
|
@ -170,6 +170,7 @@ export function createNamedTupleType(
|
|||
entriesArg.valueExpression &&
|
||||
entriesArg.valueExpression.nodeType === ParseNodeType.StringList
|
||||
) {
|
||||
const entryNameNode = entriesArg.valueExpression;
|
||||
const entries = entriesArg.valueExpression.d.strings
|
||||
.map((s) => s.d.value)
|
||||
.join('')
|
||||
|
|
@ -179,23 +180,8 @@ export function createNamedTupleType(
|
|||
entries.forEach((entryName, index) => {
|
||||
entryName = entryName.trim();
|
||||
if (entryName) {
|
||||
// Named tuples don't allow leading underscores in the field names.
|
||||
if (entryName.startsWith('_')) {
|
||||
evaluator.addDiagnostic(
|
||||
DiagnosticRule.reportGeneralTypeIssues,
|
||||
LocMessage.namedTupleFieldUnderscore(),
|
||||
entriesArg.valueExpression!
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
entryName = renameKeyword(
|
||||
evaluator,
|
||||
entryName,
|
||||
allowRename,
|
||||
entriesArg.valueExpression!,
|
||||
index
|
||||
);
|
||||
entryName = renameUnderscore(evaluator, entryName, allowRename, entryNameNode, index);
|
||||
entryName = renameKeyword(evaluator, entryName, allowRename, entryNameNode, index);
|
||||
|
||||
const entryType = UnknownType.create();
|
||||
const paramInfo = FunctionParam.create(
|
||||
|
|
@ -214,15 +200,14 @@ export function createNamedTupleType(
|
|||
// In this case it's just part of a string literal value.
|
||||
// The definition provider won't necessarily take the
|
||||
// user to the exact spot in the string, but it's close enough.
|
||||
const stringNode = entriesArg.valueExpression!;
|
||||
const declaration: VariableDeclaration = {
|
||||
type: DeclarationType.Variable,
|
||||
node: stringNode as StringListNode,
|
||||
node: entryNameNode,
|
||||
isRuntimeTypeExpression: true,
|
||||
uri: fileInfo.fileUri,
|
||||
range: convertOffsetsToRange(
|
||||
stringNode.start,
|
||||
TextRange.getEnd(stringNode),
|
||||
entryNameNode.start,
|
||||
TextRange.getEnd(entryNameNode),
|
||||
fileInfo.lines
|
||||
),
|
||||
moduleName: fileInfo.moduleName,
|
||||
|
|
@ -289,16 +274,7 @@ export function createNamedTupleType(
|
|||
entryNameNode
|
||||
);
|
||||
} else {
|
||||
// Named tuples don't allow leading underscores in the field names.
|
||||
if (entryName.startsWith('_')) {
|
||||
evaluator.addDiagnostic(
|
||||
DiagnosticRule.reportGeneralTypeIssues,
|
||||
LocMessage.namedTupleFieldUnderscore(),
|
||||
entryNameNode
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
entryName = renameUnderscore(evaluator, entryName, allowRename, entryNameNode, index);
|
||||
entryName = renameKeyword(evaluator, entryName, allowRename, entryNameNode, index);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -513,3 +489,25 @@ function renameKeyword(
|
|||
evaluator.addDiagnostic(DiagnosticRule.reportGeneralTypeIssues, LocMessage.namedTupleNameKeyword(), errorNode);
|
||||
return name;
|
||||
}
|
||||
|
||||
function renameUnderscore(
|
||||
evaluator: TypeEvaluator,
|
||||
name: string,
|
||||
allowRename: boolean,
|
||||
errorNode: ExpressionNode,
|
||||
index: number
|
||||
): string {
|
||||
if (!name.startsWith('_')) {
|
||||
// No rename necessary.
|
||||
return name;
|
||||
}
|
||||
|
||||
if (allowRename) {
|
||||
// Rename based on index.
|
||||
return `_${index}`;
|
||||
}
|
||||
|
||||
evaluator.addDiagnostic(DiagnosticRule.reportGeneralTypeIssues, LocMessage.namedTupleFieldUnderscore(), errorNode);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -707,18 +707,35 @@ function narrowTypeBasedOnLiteralPattern(
|
|||
|
||||
return evaluator.mapSubtypesExpandTypeVars(type, /* options */ undefined, (expandedSubtype, unexpandedSubtype) => {
|
||||
if (evaluator.assignType(expandedSubtype, literalType)) {
|
||||
return literalType;
|
||||
// We have to be careful here because the runtime uses an equality
|
||||
// check, but the expandedSubtype could be a superclass that is not
|
||||
// the literal type. For example, the expanded subtype might be float
|
||||
// and the literal type is Literal[3]. A value of 3.0 will match this
|
||||
// pattern, but we cannot narrow it to Literal[3] in this case.
|
||||
if (
|
||||
!isClassInstance(literalType) ||
|
||||
!isLiteralType(literalType) ||
|
||||
isTypeSame(evaluator.stripLiteralValue(expandedSubtype), evaluator.stripLiteralValue(literalType))
|
||||
) {
|
||||
return literalType;
|
||||
}
|
||||
|
||||
return expandedSubtype;
|
||||
}
|
||||
|
||||
// See if the subtype is a subclass of the literal's class. For example,
|
||||
// if it's a literal str, see if the subtype is subclass of str.
|
||||
if (
|
||||
isClassInstance(literalType) &&
|
||||
isLiteralType(literalType) &&
|
||||
isClassInstance(expandedSubtype) &&
|
||||
!isLiteralType(expandedSubtype)
|
||||
) {
|
||||
if (evaluator.assignType(ClassType.cloneWithLiteral(literalType, /* value */ undefined), expandedSubtype)) {
|
||||
if (isClassInstance(literalType) && isClassInstance(expandedSubtype)) {
|
||||
if (isLiteralType(literalType) && !isLiteralType(expandedSubtype)) {
|
||||
if (
|
||||
evaluator.assignType(
|
||||
ClassType.cloneWithLiteral(literalType, /* value */ undefined),
|
||||
expandedSubtype
|
||||
)
|
||||
) {
|
||||
return expandedSubtype;
|
||||
}
|
||||
} else if (evaluator.assignType(literalType, expandedSubtype)) {
|
||||
return expandedSubtype;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1151,9 +1151,12 @@ export class ConfigOptions {
|
|||
initializeFromJson(configObj: any, configDirUri: Uri, serviceProvider: ServiceProvider, host: Host) {
|
||||
this.initializedFromJson = true;
|
||||
const console = serviceProvider.tryGet(ServiceKeys.console) ?? new NullConsole();
|
||||
const configObjKeys = configObj && typeof configObj === 'object' ? Object.getOwnPropertyNames(configObj) : [];
|
||||
const unusedConfigKeys = new Set<string>(configObjKeys);
|
||||
|
||||
// Read the "include" entry.
|
||||
if (configObj.include !== undefined) {
|
||||
unusedConfigKeys.delete('include');
|
||||
if (!Array.isArray(configObj.include)) {
|
||||
console.error(`Config "include" entry must contain an array.`);
|
||||
} else {
|
||||
|
|
@ -1173,6 +1176,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "exclude" entry.
|
||||
if (configObj.exclude !== undefined) {
|
||||
unusedConfigKeys.delete('exclude');
|
||||
if (!Array.isArray(configObj.exclude)) {
|
||||
console.error(`Config "exclude" entry must contain an array.`);
|
||||
} else {
|
||||
|
|
@ -1192,6 +1196,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "ignore" entry.
|
||||
if (configObj.ignore !== undefined) {
|
||||
unusedConfigKeys.delete('ignore');
|
||||
if (!Array.isArray(configObj.ignore)) {
|
||||
console.error(`Config "ignore" entry must contain an array.`);
|
||||
} else {
|
||||
|
|
@ -1213,6 +1218,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "strict" entry.
|
||||
if (configObj.strict !== undefined) {
|
||||
unusedConfigKeys.delete('strict');
|
||||
if (!Array.isArray(configObj.strict)) {
|
||||
console.error(`Config "strict" entry must contain an array.`);
|
||||
} else {
|
||||
|
|
@ -1232,6 +1238,7 @@ export class ConfigOptions {
|
|||
|
||||
// If there is a "typeCheckingMode", it can override the provided setting.
|
||||
if (configObj.typeCheckingMode !== undefined) {
|
||||
unusedConfigKeys.delete('typeCheckingMode');
|
||||
if (
|
||||
configObj.typeCheckingMode === 'off' ||
|
||||
configObj.typeCheckingMode === 'basic' ||
|
||||
|
|
@ -1245,6 +1252,7 @@ export class ConfigOptions {
|
|||
}
|
||||
|
||||
if (configObj.useLibraryCodeForTypes !== undefined) {
|
||||
unusedConfigKeys.delete('useLibraryCodeForTypes');
|
||||
if (typeof configObj.useLibraryCodeForTypes === 'boolean') {
|
||||
this.useLibraryCodeForTypes = configObj.useLibraryCodeForTypes;
|
||||
} else {
|
||||
|
|
@ -1255,6 +1263,7 @@ export class ConfigOptions {
|
|||
// Apply overrides from the config file for the boolean rules.
|
||||
const configRuleSet = { ...this.diagnosticRuleSet };
|
||||
getBooleanDiagnosticRules(/* includeNonOverridable */ true).forEach((ruleName) => {
|
||||
unusedConfigKeys.delete(ruleName);
|
||||
(configRuleSet as any)[ruleName] = this._convertBoolean(
|
||||
configObj[ruleName],
|
||||
ruleName,
|
||||
|
|
@ -1264,6 +1273,7 @@ export class ConfigOptions {
|
|||
|
||||
// Apply overrides from the config file for the diagnostic level rules.
|
||||
getDiagLevelDiagnosticRules().forEach((ruleName) => {
|
||||
unusedConfigKeys.delete(ruleName);
|
||||
(configRuleSet as any)[ruleName] = this._convertDiagnosticLevel(
|
||||
configObj[ruleName],
|
||||
ruleName,
|
||||
|
|
@ -1274,6 +1284,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "venvPath".
|
||||
if (configObj.venvPath !== undefined) {
|
||||
unusedConfigKeys.delete('venvPath');
|
||||
if (typeof configObj.venvPath !== 'string') {
|
||||
console.error(`Config "venvPath" field must contain a string.`);
|
||||
} else {
|
||||
|
|
@ -1283,6 +1294,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "venv" name.
|
||||
if (configObj.venv !== undefined) {
|
||||
unusedConfigKeys.delete('venv');
|
||||
if (typeof configObj.venv !== 'string') {
|
||||
console.error(`Config "venv" field must contain a string.`);
|
||||
} else {
|
||||
|
|
@ -1293,6 +1305,7 @@ export class ConfigOptions {
|
|||
// Read the config "extraPaths".
|
||||
const configExtraPaths: Uri[] = [];
|
||||
if (configObj.extraPaths !== undefined) {
|
||||
unusedConfigKeys.delete('extraPaths');
|
||||
if (!Array.isArray(configObj.extraPaths)) {
|
||||
console.error(`Config "extraPaths" field must contain an array.`);
|
||||
} else {
|
||||
|
|
@ -1310,6 +1323,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the default "pythonVersion".
|
||||
if (configObj.pythonVersion !== undefined) {
|
||||
unusedConfigKeys.delete('pythonVersion');
|
||||
if (typeof configObj.pythonVersion === 'string') {
|
||||
const version = PythonVersion.fromString(configObj.pythonVersion);
|
||||
if (version) {
|
||||
|
|
@ -1324,6 +1338,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the default "pythonPlatform".
|
||||
if (configObj.pythonPlatform !== undefined) {
|
||||
unusedConfigKeys.delete('pythonPlatform');
|
||||
if (typeof configObj.pythonPlatform !== 'string') {
|
||||
console.error(`Config "pythonPlatform" field must contain a string.`);
|
||||
} else {
|
||||
|
|
@ -1335,7 +1350,8 @@ export class ConfigOptions {
|
|||
// or supported. It was added specifically to improve initialization
|
||||
// performance for playgrounds or web-based environments where native
|
||||
// libraries will not be present.
|
||||
if (configObj.skipNativeLibraries) {
|
||||
if (configObj.skipNativeLibraries !== undefined) {
|
||||
unusedConfigKeys.delete('skipNativeLibraries');
|
||||
if (typeof configObj.skipNativeLibraries === 'boolean') {
|
||||
this.skipNativeLibraries = configObj.skipNativeLibraries;
|
||||
} else {
|
||||
|
|
@ -1345,6 +1361,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "typeshedPath" setting.
|
||||
if (configObj.typeshedPath !== undefined) {
|
||||
unusedConfigKeys.delete('typeshedPath');
|
||||
if (typeof configObj.typeshedPath !== 'string') {
|
||||
console.error(`Config "typeshedPath" field must contain a string.`);
|
||||
} else {
|
||||
|
|
@ -1358,6 +1375,7 @@ export class ConfigOptions {
|
|||
|
||||
// Keep this for backward compatibility
|
||||
if (configObj.typingsPath !== undefined) {
|
||||
unusedConfigKeys.delete('typingsPath');
|
||||
if (typeof configObj.typingsPath !== 'string') {
|
||||
console.error(`Config "typingsPath" field must contain a string.`);
|
||||
} else {
|
||||
|
|
@ -1367,6 +1385,7 @@ export class ConfigOptions {
|
|||
}
|
||||
|
||||
if (configObj.stubPath !== undefined) {
|
||||
unusedConfigKeys.delete('stubPath');
|
||||
if (typeof configObj.stubPath !== 'string') {
|
||||
console.error(`Config "stubPath" field must contain a string.`);
|
||||
} else {
|
||||
|
|
@ -1378,6 +1397,7 @@ export class ConfigOptions {
|
|||
// Don't initialize to a default value because we want the command-line "verbose"
|
||||
// switch to apply if this setting isn't specified in the config file.
|
||||
if (configObj.verboseOutput !== undefined) {
|
||||
unusedConfigKeys.delete('verboseOutput');
|
||||
if (typeof configObj.verboseOutput !== 'boolean') {
|
||||
console.error(`Config "verboseOutput" field must be true or false.`);
|
||||
} else {
|
||||
|
|
@ -1387,6 +1407,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "defineConstant" setting.
|
||||
if (configObj.defineConstant !== undefined) {
|
||||
unusedConfigKeys.delete('defineConstant');
|
||||
if (typeof configObj.defineConstant !== 'object' || Array.isArray(configObj.defineConstant)) {
|
||||
console.error(`Config "defineConstant" field must contain a map indexed by constant names.`);
|
||||
} else {
|
||||
|
|
@ -1405,6 +1426,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "useLibraryCodeForTypes" setting.
|
||||
if (configObj.useLibraryCodeForTypes !== undefined) {
|
||||
unusedConfigKeys.delete('useLibraryCodeForTypes');
|
||||
if (typeof configObj.useLibraryCodeForTypes !== 'boolean') {
|
||||
console.error(`Config "useLibraryCodeForTypes" field must be true or false.`);
|
||||
} else {
|
||||
|
|
@ -1414,6 +1436,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "autoImportCompletions" setting.
|
||||
if (configObj.autoImportCompletions !== undefined) {
|
||||
unusedConfigKeys.delete('autoImportCompletions');
|
||||
if (typeof configObj.autoImportCompletions !== 'boolean') {
|
||||
console.error(`Config "autoImportCompletions" field must be true or false.`);
|
||||
} else {
|
||||
|
|
@ -1423,6 +1446,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "indexing" setting.
|
||||
if (configObj.indexing !== undefined) {
|
||||
unusedConfigKeys.delete('indexing');
|
||||
if (typeof configObj.indexing !== 'boolean') {
|
||||
console.error(`Config "indexing" field must be true or false.`);
|
||||
} else {
|
||||
|
|
@ -1432,6 +1456,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "logTypeEvaluationTime" setting.
|
||||
if (configObj.logTypeEvaluationTime !== undefined) {
|
||||
unusedConfigKeys.delete('logTypeEvaluationTime');
|
||||
if (typeof configObj.logTypeEvaluationTime !== 'boolean') {
|
||||
console.error(`Config "logTypeEvaluationTime" field must be true or false.`);
|
||||
} else {
|
||||
|
|
@ -1441,6 +1466,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "typeEvaluationTimeThreshold" setting.
|
||||
if (configObj.typeEvaluationTimeThreshold !== undefined) {
|
||||
unusedConfigKeys.delete('typeEvaluationTimeThreshold');
|
||||
if (typeof configObj.typeEvaluationTimeThreshold !== 'number') {
|
||||
console.error(`Config "typeEvaluationTimeThreshold" field must be a number.`);
|
||||
} else {
|
||||
|
|
@ -1450,6 +1476,7 @@ export class ConfigOptions {
|
|||
|
||||
// Read the "functionSignatureDisplay" setting.
|
||||
if (configObj.functionSignatureDisplay !== undefined) {
|
||||
unusedConfigKeys.delete('functionSignatureDisplay');
|
||||
if (typeof configObj.functionSignatureDisplay !== 'string') {
|
||||
console.error(`Config "functionSignatureDisplay" field must be true or false.`);
|
||||
} else {
|
||||
|
|
@ -1461,6 +1488,13 @@ export class ConfigOptions {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
unusedConfigKeys.delete('executionEnvironments');
|
||||
unusedConfigKeys.delete('extends');
|
||||
|
||||
Array.from(unusedConfigKeys).forEach((unknownKey) => {
|
||||
console.error(`Config contains unrecognized setting "${unknownKey}".`);
|
||||
});
|
||||
}
|
||||
|
||||
static resolveExtends(configObj: any, configDirUri: Uri): Uri | undefined {
|
||||
|
|
@ -1626,6 +1660,9 @@ export class ConfigOptions {
|
|||
configExtraPaths: Uri[]
|
||||
): ExecutionEnvironment | undefined {
|
||||
try {
|
||||
const envObjKeys = envObj && typeof envObj === 'object' ? Object.getOwnPropertyNames(envObj) : [];
|
||||
const unusedEnvKeys = new Set<string>(envObjKeys);
|
||||
|
||||
const newExecEnv = new ExecutionEnvironment(
|
||||
this._getEnvironmentName(),
|
||||
configDirUri,
|
||||
|
|
@ -1636,6 +1673,7 @@ export class ConfigOptions {
|
|||
);
|
||||
|
||||
// Validate the root.
|
||||
unusedEnvKeys.delete('root');
|
||||
if (envObj.root && typeof envObj.root === 'string') {
|
||||
newExecEnv.root = configDirUri.resolvePaths(envObj.root);
|
||||
} else {
|
||||
|
|
@ -1643,6 +1681,7 @@ export class ConfigOptions {
|
|||
}
|
||||
|
||||
// Validate the extraPaths.
|
||||
unusedEnvKeys.delete('extraPaths');
|
||||
if (envObj.extraPaths) {
|
||||
if (!Array.isArray(envObj.extraPaths)) {
|
||||
console.error(
|
||||
|
|
@ -1668,6 +1707,7 @@ export class ConfigOptions {
|
|||
}
|
||||
|
||||
// Validate the pythonVersion.
|
||||
unusedEnvKeys.delete('pythonVersion');
|
||||
if (envObj.pythonVersion) {
|
||||
if (typeof envObj.pythonVersion === 'string') {
|
||||
const version = PythonVersion.fromString(envObj.pythonVersion);
|
||||
|
|
@ -1682,6 +1722,7 @@ export class ConfigOptions {
|
|||
}
|
||||
|
||||
// Validate the pythonPlatform.
|
||||
unusedEnvKeys.delete('pythonPlatform');
|
||||
if (envObj.pythonPlatform) {
|
||||
if (typeof envObj.pythonPlatform === 'string') {
|
||||
newExecEnv.pythonPlatform = envObj.pythonPlatform;
|
||||
|
|
@ -1691,6 +1732,7 @@ export class ConfigOptions {
|
|||
}
|
||||
|
||||
// Validate the name.
|
||||
unusedEnvKeys.delete('name');
|
||||
if (envObj.name) {
|
||||
if (typeof envObj.name === 'string') {
|
||||
newExecEnv.name = envObj.name;
|
||||
|
|
@ -1701,6 +1743,7 @@ export class ConfigOptions {
|
|||
|
||||
// Apply overrides from the config file for the boolean overrides.
|
||||
getBooleanDiagnosticRules(/* includeNonOverridable */ true).forEach((ruleName) => {
|
||||
unusedEnvKeys.delete(ruleName);
|
||||
(newExecEnv.diagnosticRuleSet as any)[ruleName] = this._convertBoolean(
|
||||
envObj[ruleName],
|
||||
ruleName,
|
||||
|
|
@ -1710,6 +1753,7 @@ export class ConfigOptions {
|
|||
|
||||
// Apply overrides from the config file for the diagnostic level overrides.
|
||||
getDiagLevelDiagnosticRules().forEach((ruleName) => {
|
||||
unusedEnvKeys.delete(ruleName);
|
||||
(newExecEnv.diagnosticRuleSet as any)[ruleName] = this._convertDiagnosticLevel(
|
||||
envObj[ruleName],
|
||||
ruleName,
|
||||
|
|
@ -1717,6 +1761,10 @@ export class ConfigOptions {
|
|||
);
|
||||
});
|
||||
|
||||
Array.from(unusedEnvKeys).forEach((unknownKey) => {
|
||||
console.error(`Config executionEnvironments index ${index}: unrecognized setting "${unknownKey}".`);
|
||||
});
|
||||
|
||||
return newExecEnv;
|
||||
} catch {
|
||||
console.error(`Config executionEnvironments index ${index} is not accessible.`);
|
||||
|
|
|
|||
|
|
@ -1563,6 +1563,10 @@ export namespace Localizer {
|
|||
new ParameterizedString<{ name: string; type: string }>(
|
||||
getRawString('DiagnosticAddendum.typedDictClosedExtraTypeMismatch')
|
||||
);
|
||||
export const typedDictClosedFieldNotReadOnly = () =>
|
||||
new ParameterizedString<{ name: string }>(
|
||||
getRawString('DiagnosticAddendum.typedDictClosedFieldNotReadOnly')
|
||||
);
|
||||
export const typedDictClosedFieldNotRequired = () =>
|
||||
new ParameterizedString<{ name: string }>(
|
||||
getRawString('DiagnosticAddendum.typedDictClosedFieldNotRequired')
|
||||
|
|
|
|||
|
|
@ -2114,6 +2114,10 @@
|
|||
},
|
||||
"typedDictClosedExtraNotAllowed": "Cannot add item \"{name}\"",
|
||||
"typedDictClosedExtraTypeMismatch": "Cannot add item \"{name}\" with type \"{type}\"",
|
||||
"typedDictClosedFieldNotReadOnly": {
|
||||
"message": "Cannot add item \"{name}\" because it must be ReadOnly",
|
||||
"comment": "{Locked='ReadOnly'}"
|
||||
},
|
||||
"typedDictClosedFieldNotRequired": {
|
||||
"message": "Cannot add item \"{name}\" because it must be NotRequired",
|
||||
"comment": "{Locked='NotRequired'}"
|
||||
|
|
|
|||
|
|
@ -2317,6 +2317,8 @@ export class Parser {
|
|||
// "dry run" to determine whether the entire list of "with items"
|
||||
// is enclosed in parentheses.
|
||||
let isParenthesizedWithItemList = false;
|
||||
let isParenthesizedDisallowed = false;
|
||||
|
||||
if (possibleParen.type === TokenType.OpenParenthesis) {
|
||||
const openParenTokenIndex = this._tokenIndex;
|
||||
|
||||
|
|
@ -2337,7 +2339,11 @@ export class Parser {
|
|||
this._peekToken().type === TokenType.CloseParenthesis &&
|
||||
this._peekToken(1).type === TokenType.Colon
|
||||
) {
|
||||
isParenthesizedWithItemList = withItemList.length !== 1 || withItemList[0].d.target !== undefined;
|
||||
isParenthesizedWithItemList = true;
|
||||
|
||||
// Some forms of parenthesized context with statements were not
|
||||
// allowed prior to Python 3.9. Is this such a form?
|
||||
isParenthesizedDisallowed = withItemList.length !== 1 || withItemList[0].d.target !== undefined;
|
||||
}
|
||||
|
||||
this._tokenIndex = openParenTokenIndex;
|
||||
|
|
@ -2347,7 +2353,7 @@ export class Parser {
|
|||
|
||||
if (isParenthesizedWithItemList) {
|
||||
this._consumeTokenIfType(TokenType.OpenParenthesis);
|
||||
if (PythonVersion.isLessThan(this._getLanguageVersion(), pythonVersion3_9)) {
|
||||
if (isParenthesizedDisallowed && PythonVersion.isLessThan(this._getLanguageVersion(), pythonVersion3_9)) {
|
||||
this._addSyntaxError(LocMessage.parenthesizedContextManagerIllegal(), possibleParen);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ async function runSingleThreaded(
|
|||
}
|
||||
}
|
||||
|
||||
if (args.createstub && results.requiringAnalysisCount.files === 0) {
|
||||
if (args.createstub) {
|
||||
try {
|
||||
service.writeTypeStub(cancellationNone);
|
||||
service.dispose();
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ from typing import Literal, TypeVar
|
|||
def test_unknown(value_to_match):
|
||||
match value_to_match:
|
||||
case 3 as a1, -3 as a2:
|
||||
reveal_type(a1, expected_text="Literal[3]")
|
||||
reveal_type(a2, expected_text="Literal[-3]")
|
||||
reveal_type(value_to_match, expected_text="Sequence[int]")
|
||||
reveal_type(a1, expected_text="Unknown")
|
||||
reveal_type(a2, expected_text="Unknown")
|
||||
reveal_type(value_to_match, expected_text="Sequence[Unknown]")
|
||||
|
||||
case 3j as b1, -3 + 5j as b2:
|
||||
reveal_type(b1, expected_text="complex")
|
||||
|
|
@ -18,44 +18,62 @@ def test_unknown(value_to_match):
|
|||
reveal_type(value_to_match, expected_text="Sequence[complex]")
|
||||
|
||||
case "hi" as c1, None as c2:
|
||||
reveal_type(c1, expected_text="Literal['hi']")
|
||||
reveal_type(c1, expected_text="Unknown")
|
||||
reveal_type(c2, expected_text="None")
|
||||
reveal_type(value_to_match, expected_text="Sequence[str | None]")
|
||||
reveal_type(value_to_match, expected_text="Sequence[Unknown]")
|
||||
|
||||
case True as d1, False as d2:
|
||||
reveal_type(d1, expected_text="Literal[True]")
|
||||
reveal_type(d2, expected_text="Literal[False]")
|
||||
reveal_type(value_to_match, expected_text="Sequence[bool]")
|
||||
reveal_type(d1, expected_text="Unknown")
|
||||
reveal_type(d2, expected_text="Unknown")
|
||||
reveal_type(value_to_match, expected_text="Sequence[Unknown]")
|
||||
|
||||
|
||||
def test_tuple(value_to_match: tuple[int | float | str | complex, ...]):
|
||||
match value_to_match:
|
||||
case (3, -3) as a1:
|
||||
reveal_type(a1, expected_text="tuple[Literal[3], Literal[-3]]")
|
||||
reveal_type(value_to_match, expected_text="tuple[Literal[3], Literal[-3]]")
|
||||
reveal_type(
|
||||
a1,
|
||||
expected_text="tuple[float | complex | Literal[3], float | complex | Literal[-3]]",
|
||||
)
|
||||
reveal_type(
|
||||
value_to_match,
|
||||
expected_text="tuple[float | complex | Literal[3], float | complex | Literal[-3]]",
|
||||
)
|
||||
|
||||
case (3j, -3 + 5j) as b1:
|
||||
reveal_type(b1, expected_text="tuple[complex, complex]")
|
||||
reveal_type(value_to_match, expected_text="tuple[complex, complex]")
|
||||
reveal_type(
|
||||
b1, expected_text="tuple[int | float | complex, int | float | complex]"
|
||||
)
|
||||
reveal_type(
|
||||
value_to_match,
|
||||
expected_text="tuple[int | float | complex, int | float | complex]",
|
||||
)
|
||||
|
||||
|
||||
def test_union(value_to_match: int | float | str | complex | bool | None):
|
||||
match value_to_match:
|
||||
case (3 | -3j) as a1:
|
||||
reveal_type(a1, expected_text="bool | complex | Literal[3]")
|
||||
reveal_type(value_to_match, expected_text="bool | complex | Literal[3]")
|
||||
reveal_type(a1, expected_text="float | complex | bool | int")
|
||||
reveal_type(value_to_match, expected_text="float | complex | bool | int")
|
||||
|
||||
case (True | False | 3.4 | -3 + 3j | None) as b1:
|
||||
reveal_type(b1, expected_text="float | complex | bool | None")
|
||||
reveal_type(value_to_match, expected_text="float | complex | bool | None")
|
||||
reveal_type(b1, expected_text="int | float | complex | bool | None")
|
||||
reveal_type(
|
||||
value_to_match, expected_text="int | float | complex | bool | None"
|
||||
)
|
||||
|
||||
case ("hi" | 3.4) as c1:
|
||||
reveal_type(c1, expected_text="float | Literal['hi']")
|
||||
reveal_type(value_to_match, expected_text="float | Literal['hi']")
|
||||
reveal_type(c1, expected_text="int | float | Literal['hi']")
|
||||
reveal_type(value_to_match, expected_text="int | float | Literal['hi']")
|
||||
|
||||
case ((True | "True") as d1) | ((False | "False") as d1):
|
||||
reveal_type(d1, expected_text="bool | Literal['True', 'False']")
|
||||
reveal_type(value_to_match, expected_text="bool | Literal['True', 'False']")
|
||||
reveal_type(
|
||||
d1, expected_text="int | float | complex | Literal['True', 'False']"
|
||||
)
|
||||
reveal_type(
|
||||
value_to_match,
|
||||
expected_text="int | float | complex | Literal['True', 'False']",
|
||||
)
|
||||
|
||||
|
||||
def test_none(value_to_match: int | None):
|
||||
|
|
@ -70,7 +88,7 @@ def test_none(value_to_match: int | None):
|
|||
class A(str): ...
|
||||
|
||||
|
||||
def test_subclass(a: A):
|
||||
def test_subclass1(a: A):
|
||||
match a:
|
||||
case "TEST" as m:
|
||||
reveal_type(m, expected_text="A")
|
||||
|
|
@ -78,6 +96,18 @@ def test_subclass(a: A):
|
|||
reveal_type(x, expected_text="A")
|
||||
|
||||
|
||||
def test_subclass2(subj: int):
|
||||
match subj:
|
||||
case 1.0e4:
|
||||
reveal_type(subj, expected_text="int")
|
||||
|
||||
|
||||
def test_subclass3(subj: Literal[1]):
|
||||
match subj:
|
||||
case 1.0:
|
||||
reveal_type(subj, expected_text="Literal[1]")
|
||||
|
||||
|
||||
T1 = TypeVar("T1", Literal["A"], Literal["B"])
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ def test_dict(value_to_match: dict[str | int, str | int]):
|
|||
reveal_type(b3, expected_text="dict[str | int, str | int]")
|
||||
reveal_type(value_to_match, expected_text="dict[str | int, str | int]")
|
||||
|
||||
case {3j: c1}:
|
||||
case {None: c1}:
|
||||
reveal_type(c1, expected_text="Never")
|
||||
reveal_type(value_to_match, expected_text="Never")
|
||||
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ def test_union(
|
|||
reveal_type(e1, expected_text="complex | float | Any")
|
||||
reveal_type(
|
||||
value_to_match,
|
||||
expected_text="tuple[Literal[3], complex] | tuple[Literal[3], float] | Sequence[Any]",
|
||||
expected_text="tuple[complex, complex] | tuple[float, float] | Sequence[Any]",
|
||||
)
|
||||
|
||||
case "hi", *f1:
|
||||
|
|
@ -267,11 +267,12 @@ def test_union(
|
|||
|
||||
case *g1, 3j:
|
||||
reveal_type(
|
||||
g1, expected_text="list[complex] | list[int | str | float] | list[Any]"
|
||||
g1,
|
||||
expected_text="list[complex] | list[int | str | float] | list[float] | list[Any]",
|
||||
)
|
||||
reveal_type(
|
||||
value_to_match,
|
||||
expected_text="tuple[complex, complex] | Tuple[int, str, float, complex] | Sequence[Any]",
|
||||
expected_text="tuple[complex, complex] | Tuple[int, str, float, complex] | Tuple[float, ...] | Sequence[Any]",
|
||||
)
|
||||
|
||||
case *h1, "hi":
|
||||
|
|
@ -369,8 +370,8 @@ def test_object1(seq: object):
|
|||
reveal_type(seq, expected_text="Sequence[Unknown]")
|
||||
|
||||
case [1, "hi", True] as h1:
|
||||
reveal_type(h1, expected_text="Sequence[int | str | bool]")
|
||||
reveal_type(seq, expected_text="Sequence[int | str | bool]")
|
||||
reveal_type(h1, expected_text="Sequence[Unknown]")
|
||||
reveal_type(seq, expected_text="Sequence[Unknown]")
|
||||
|
||||
case [1, i1] as i2:
|
||||
reveal_type(i1, expected_text="Unknown")
|
||||
|
|
|
|||
|
|
@ -17,3 +17,6 @@ class NT3(NamedTuple):
|
|||
# This should generate an error because a field name starting with an
|
||||
# underscore isn't allowed.
|
||||
_oops: int
|
||||
|
||||
|
||||
NT4 = namedtuple("NT4", "a, b, _c", rename=True)
|
||||
|
|
|
|||
|
|
@ -125,15 +125,28 @@ class MovieWithYear(MovieBase):
|
|||
class ParentNonOpen5(TypedDict, closed=True):
|
||||
pass
|
||||
|
||||
|
||||
# This should generate an error because a subclass of
|
||||
# a closed TypedDict cannot be open.
|
||||
class ChildNotClosed5(ParentNonOpen5, closed=False):
|
||||
pass
|
||||
|
||||
|
||||
class ParentNonOpen6(TypedDict, extra_items=str):
|
||||
pass
|
||||
|
||||
|
||||
# This should generate an error because a subclass of
|
||||
# a closed TypedDict cannot be open.
|
||||
class ChildNotClosed6(ParentNonOpen6, closed=False):
|
||||
pass
|
||||
|
||||
|
||||
class ParentNonOpen7(TypedDict, extra_items=str):
|
||||
pass
|
||||
|
||||
|
||||
# This should generate an error because added fields
|
||||
# cannot be ReadOnly.
|
||||
class ChildNotClosed7(ParentNonOpen7):
|
||||
a: NotRequired[ReadOnly[str]]
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ test('TypedDictClosed2', () => {
|
|||
|
||||
test('TypedDictClosed3', () => {
|
||||
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed3.py']);
|
||||
TestUtils.validateResults(analysisResults, 12);
|
||||
TestUtils.validateResults(analysisResults, 13);
|
||||
});
|
||||
|
||||
test('TypedDictClosed4', () => {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
c7d0fd95f317f0a0b57e89af01a09880449ae4f5
|
||||
a205439338a4ad3debec1eeae7d300e3781c066d
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ else:
|
|||
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
|
||||
|
||||
def writer(
|
||||
csvfile: SupportsWrite[str],
|
||||
fileobj: SupportsWrite[str],
|
||||
/,
|
||||
dialect: _DialectLike = "excel",
|
||||
*,
|
||||
|
|
@ -106,7 +106,7 @@ def writer(
|
|||
strict: bool = False,
|
||||
) -> _writer: ...
|
||||
def reader(
|
||||
csvfile: Iterable[str],
|
||||
iterable: Iterable[str],
|
||||
/,
|
||||
dialect: _DialectLike = "excel",
|
||||
*,
|
||||
|
|
@ -121,7 +121,8 @@ def reader(
|
|||
) -> _reader: ...
|
||||
def register_dialect(
|
||||
name: str,
|
||||
dialect: type[Dialect | csv.Dialect] = ...,
|
||||
/,
|
||||
dialect: type[Dialect | csv.Dialect] | str = "excel",
|
||||
*,
|
||||
delimiter: str = ",",
|
||||
quotechar: str | None = '"',
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ def __import__(
|
|||
name: str,
|
||||
globals: Mapping[str, object] | None = None,
|
||||
locals: Mapping[str, object] | None = None,
|
||||
fromlist: Sequence[str] = (),
|
||||
fromlist: Sequence[str] | None = (),
|
||||
level: int = 0,
|
||||
) -> ModuleType: ...
|
||||
def spec_from_loader(
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class SourceLoader(_LoaderBasics):
|
|||
def get_source(self, fullname: str) -> str | None: ...
|
||||
def path_stats(self, path: str) -> Mapping[str, Any]: ...
|
||||
def source_to_code(
|
||||
self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath
|
||||
self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: bytes | StrPath
|
||||
) -> types.CodeType: ...
|
||||
def get_code(self, fullname: str) -> types.CodeType | None: ...
|
||||
|
||||
|
|
@ -109,8 +109,8 @@ class FileLoader:
|
|||
path: str
|
||||
def __init__(self, fullname: str, path: str) -> None: ...
|
||||
def get_data(self, path: str) -> bytes: ...
|
||||
def get_filename(self, name: str | None = None) -> str: ...
|
||||
def load_module(self, name: str | None = None) -> types.ModuleType: ...
|
||||
def get_filename(self, fullname: str | None = None) -> str: ...
|
||||
def load_module(self, fullname: str | None = None) -> types.ModuleType: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
def get_resource_reader(self, name: str | None = None) -> importlib.readers.FileReader: ...
|
||||
else:
|
||||
|
|
@ -126,7 +126,7 @@ class SourceFileLoader(importlib.abc.FileLoader, FileLoader, importlib.abc.Sourc
|
|||
def source_to_code( # type: ignore[override] # incompatible with InspectLoader.source_to_code
|
||||
self,
|
||||
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
path: ReadableBuffer | StrPath,
|
||||
path: bytes | StrPath,
|
||||
*,
|
||||
_optimize: int = -1,
|
||||
) -> types.CodeType: ...
|
||||
|
|
@ -137,7 +137,7 @@ class SourcelessFileLoader(importlib.abc.FileLoader, FileLoader, _LoaderBasics):
|
|||
|
||||
class ExtensionFileLoader(FileLoader, _LoaderBasics, importlib.abc.ExecutionLoader):
|
||||
def __init__(self, name: str, path: str) -> None: ...
|
||||
def get_filename(self, name: str | None = None) -> str: ...
|
||||
def get_filename(self, fullname: str | None = None) -> str: ...
|
||||
def get_source(self, fullname: str) -> None: ...
|
||||
def create_module(self, spec: ModuleSpec) -> types.ModuleType: ...
|
||||
def exec_module(self, module: types.ModuleType) -> None: ...
|
||||
|
|
|
|||
|
|
@ -142,6 +142,9 @@ class SupportsIter(Protocol[_T_co]):
|
|||
class SupportsAiter(Protocol[_T_co]):
|
||||
def __aiter__(self) -> _T_co: ...
|
||||
|
||||
class SupportsLen(Protocol):
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class SupportsLenAndGetItem(Protocol[_T_co]):
|
||||
def __len__(self) -> int: ...
|
||||
def __getitem__(self, k: int, /) -> _T_co: ...
|
||||
|
|
|
|||
|
|
@ -1744,10 +1744,20 @@ if sys.version_info < (3, 14):
|
|||
_T = _TypeVar("_T", bound=AST)
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
@overload
|
||||
def parse(
|
||||
source: _T,
|
||||
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||
mode: Literal["exec", "eval", "func_type", "single"] = "exec",
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
feature_version: None | int | tuple[int, int] = None,
|
||||
optimize: Literal[-1, 0, 1, 2] = -1,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
||||
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||
mode: Literal["exec"] = "exec",
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
@ -1757,7 +1767,7 @@ if sys.version_info >= (3, 13):
|
|||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
||||
filename: str | bytes | os.PathLike[Any],
|
||||
mode: Literal["eval"],
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
@ -1767,7 +1777,7 @@ if sys.version_info >= (3, 13):
|
|||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
||||
filename: str | bytes | os.PathLike[Any],
|
||||
mode: Literal["func_type"],
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
@ -1777,7 +1787,7 @@ if sys.version_info >= (3, 13):
|
|||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
||||
filename: str | bytes | os.PathLike[Any],
|
||||
mode: Literal["single"],
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
@ -1814,7 +1824,7 @@ if sys.version_info >= (3, 13):
|
|||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
||||
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||
mode: str = "exec",
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
@ -1823,10 +1833,19 @@ if sys.version_info >= (3, 13):
|
|||
) -> mod: ...
|
||||
|
||||
else:
|
||||
@overload
|
||||
def parse(
|
||||
source: _T,
|
||||
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||
mode: Literal["exec", "eval", "func_type", "single"] = "exec",
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
feature_version: None | int | tuple[int, int] = None,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
||||
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||
mode: Literal["exec"] = "exec",
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
@ -1835,7 +1854,7 @@ else:
|
|||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
||||
filename: str | bytes | os.PathLike[Any],
|
||||
mode: Literal["eval"],
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
@ -1844,7 +1863,7 @@ else:
|
|||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
||||
filename: str | bytes | os.PathLike[Any],
|
||||
mode: Literal["func_type"],
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
@ -1853,7 +1872,7 @@ else:
|
|||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any],
|
||||
filename: str | bytes | os.PathLike[Any],
|
||||
mode: Literal["single"],
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
@ -1886,7 +1905,7 @@ else:
|
|||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
||||
filename: str | bytes | os.PathLike[Any] = "<unknown>",
|
||||
mode: str = "exec",
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
|
|
|
|||
|
|
@ -226,8 +226,10 @@ class type:
|
|||
@classmethod
|
||||
def __prepare__(metacls, name: str, bases: tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
def __or__(self, value: Any, /) -> types.UnionType: ...
|
||||
def __ror__(self, value: Any, /) -> types.UnionType: ...
|
||||
# `int | str` produces an instance of `UnionType`, but `int | int` produces an instance of `type`,
|
||||
# and `abc.ABC | abc.ABC` produces an instance of `abc.ABCMeta`.
|
||||
def __or__(self: _typeshed.Self, value: Any, /) -> types.UnionType | _typeshed.Self: ...
|
||||
def __ror__(self: _typeshed.Self, value: Any, /) -> types.UnionType | _typeshed.Self: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
|
||||
__annotations__: dict[str, AnnotationForm]
|
||||
|
|
@ -250,7 +252,7 @@ _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026
|
|||
@disjoint_base
|
||||
class int:
|
||||
@overload
|
||||
def __new__(cls, x: ConvertibleToInt = ..., /) -> Self: ...
|
||||
def __new__(cls, x: ConvertibleToInt = 0, /) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, x: str | bytes | bytearray, /, base: SupportsIndex) -> Self: ...
|
||||
def as_integer_ratio(self) -> tuple[int, Literal[1]]: ...
|
||||
|
|
@ -360,7 +362,7 @@ class int:
|
|||
|
||||
@disjoint_base
|
||||
class float:
|
||||
def __new__(cls, x: ConvertibleToFloat = ..., /) -> Self: ...
|
||||
def __new__(cls, x: ConvertibleToFloat = 0, /) -> Self: ...
|
||||
def as_integer_ratio(self) -> tuple[int, int]: ...
|
||||
def hex(self) -> str: ...
|
||||
def is_integer(self) -> bool: ...
|
||||
|
|
@ -430,8 +432,8 @@ class complex:
|
|||
@overload
|
||||
def __new__(
|
||||
cls,
|
||||
real: complex | SupportsComplex | SupportsFloat | SupportsIndex = ...,
|
||||
imag: complex | SupportsFloat | SupportsIndex = ...,
|
||||
real: complex | SupportsComplex | SupportsFloat | SupportsIndex = 0,
|
||||
imag: complex | SupportsFloat | SupportsIndex = 0,
|
||||
) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, real: str | SupportsComplex | SupportsFloat | SupportsIndex | complex) -> Self: ...
|
||||
|
|
@ -475,9 +477,9 @@ class _TranslateTable(Protocol):
|
|||
@disjoint_base
|
||||
class str(Sequence[str]):
|
||||
@overload
|
||||
def __new__(cls, object: object = ...) -> Self: ...
|
||||
def __new__(cls, object: object = "") -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
|
||||
def __new__(cls, object: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> Self: ...
|
||||
@overload
|
||||
def capitalize(self: LiteralString) -> LiteralString: ...
|
||||
@overload
|
||||
|
|
@ -490,22 +492,22 @@ class str(Sequence[str]):
|
|||
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
|
||||
@overload
|
||||
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
|
||||
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
|
||||
def count(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
|
||||
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
|
||||
def endswith(
|
||||
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> bool: ...
|
||||
@overload
|
||||
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
|
||||
@overload
|
||||
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
|
||||
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
|
||||
def find(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
|
||||
@overload
|
||||
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
|
||||
@overload
|
||||
def format(self, *args: object, **kwargs: object) -> str: ...
|
||||
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
|
||||
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
|
||||
def index(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
def isascii(self) -> bool: ...
|
||||
|
|
@ -561,8 +563,8 @@ class str(Sequence[str]):
|
|||
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
|
||||
@overload
|
||||
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
|
||||
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
|
||||
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
|
||||
def rfind(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
|
||||
def rindex(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
|
||||
@overload
|
||||
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
|
||||
@overload
|
||||
|
|
@ -588,7 +590,7 @@ class str(Sequence[str]):
|
|||
@overload
|
||||
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
|
||||
def startswith(
|
||||
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> bool: ...
|
||||
@overload
|
||||
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
|
||||
|
|
@ -662,29 +664,29 @@ class bytes(Sequence[int]):
|
|||
@overload
|
||||
def __new__(cls, o: Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer, /) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, string: str, /, encoding: str, errors: str = ...) -> Self: ...
|
||||
def __new__(cls, string: str, /, encoding: str, errors: str = "strict") -> Self: ...
|
||||
@overload
|
||||
def __new__(cls) -> Self: ...
|
||||
def capitalize(self) -> bytes: ...
|
||||
def center(self, width: SupportsIndex, fillchar: bytes = b" ", /) -> bytes: ...
|
||||
def count(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: ...
|
||||
def endswith(
|
||||
self,
|
||||
suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
||||
start: SupportsIndex | None = ...,
|
||||
end: SupportsIndex | None = ...,
|
||||
start: SupportsIndex | None = None,
|
||||
end: SupportsIndex | None = None,
|
||||
/,
|
||||
) -> bool: ...
|
||||
def expandtabs(self, tabsize: SupportsIndex = 8) -> bytes: ...
|
||||
def find(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
|
||||
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = 1) -> str: ...
|
||||
def index(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
|
|
@ -703,10 +705,10 @@ class bytes(Sequence[int]):
|
|||
def removeprefix(self, prefix: ReadableBuffer, /) -> bytes: ...
|
||||
def removesuffix(self, suffix: ReadableBuffer, /) -> bytes: ...
|
||||
def rfind(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def rindex(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def rjust(self, width: SupportsIndex, fillchar: bytes | bytearray = b" ", /) -> bytes: ...
|
||||
def rpartition(self, sep: ReadableBuffer, /) -> tuple[bytes, bytes, bytes]: ...
|
||||
|
|
@ -717,8 +719,8 @@ class bytes(Sequence[int]):
|
|||
def startswith(
|
||||
self,
|
||||
prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
||||
start: SupportsIndex | None = ...,
|
||||
end: SupportsIndex | None = ...,
|
||||
start: SupportsIndex | None = None,
|
||||
end: SupportsIndex | None = None,
|
||||
/,
|
||||
) -> bool: ...
|
||||
def strip(self, bytes: ReadableBuffer | None = None, /) -> bytes: ...
|
||||
|
|
@ -763,30 +765,30 @@ class bytearray(MutableSequence[int]):
|
|||
@overload
|
||||
def __init__(self, ints: Iterable[SupportsIndex] | SupportsIndex | ReadableBuffer, /) -> None: ...
|
||||
@overload
|
||||
def __init__(self, string: str, /, encoding: str, errors: str = ...) -> None: ...
|
||||
def __init__(self, string: str, /, encoding: str, errors: str = "strict") -> None: ...
|
||||
def append(self, item: SupportsIndex, /) -> None: ...
|
||||
def capitalize(self) -> bytearray: ...
|
||||
def center(self, width: SupportsIndex, fillchar: bytes = b" ", /) -> bytearray: ...
|
||||
def count(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def copy(self) -> bytearray: ...
|
||||
def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: ...
|
||||
def endswith(
|
||||
self,
|
||||
suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
||||
start: SupportsIndex | None = ...,
|
||||
end: SupportsIndex | None = ...,
|
||||
start: SupportsIndex | None = None,
|
||||
end: SupportsIndex | None = None,
|
||||
/,
|
||||
) -> bool: ...
|
||||
def expandtabs(self, tabsize: SupportsIndex = 8) -> bytearray: ...
|
||||
def extend(self, iterable_of_ints: Iterable[SupportsIndex], /) -> None: ...
|
||||
def find(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
|
||||
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = 1) -> str: ...
|
||||
def index(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def insert(self, index: SupportsIndex, item: SupportsIndex, /) -> None: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
|
|
@ -808,10 +810,10 @@ class bytearray(MutableSequence[int]):
|
|||
def removesuffix(self, suffix: ReadableBuffer, /) -> bytearray: ...
|
||||
def replace(self, old: ReadableBuffer, new: ReadableBuffer, count: SupportsIndex = -1, /) -> bytearray: ...
|
||||
def rfind(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def rindex(
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
|
||||
self, sub: ReadableBuffer | SupportsIndex, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
|
||||
) -> int: ...
|
||||
def rjust(self, width: SupportsIndex, fillchar: bytes | bytearray = b" ", /) -> bytearray: ...
|
||||
def rpartition(self, sep: ReadableBuffer, /) -> tuple[bytearray, bytearray, bytearray]: ...
|
||||
|
|
@ -822,8 +824,8 @@ class bytearray(MutableSequence[int]):
|
|||
def startswith(
|
||||
self,
|
||||
prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
|
||||
start: SupportsIndex | None = ...,
|
||||
end: SupportsIndex | None = ...,
|
||||
start: SupportsIndex | None = None,
|
||||
end: SupportsIndex | None = None,
|
||||
/,
|
||||
) -> bool: ...
|
||||
def strip(self, bytes: ReadableBuffer | None = None, /) -> bytearray: ...
|
||||
|
|
@ -937,7 +939,7 @@ class memoryview(Sequence[_I]):
|
|||
def tolist(self) -> list[int]: ...
|
||||
def toreadonly(self) -> memoryview: ...
|
||||
def release(self) -> None: ...
|
||||
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
|
||||
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = 1) -> str: ...
|
||||
def __buffer__(self, flags: int, /) -> memoryview: ...
|
||||
def __release_buffer__(self, buffer: memoryview, /) -> None: ...
|
||||
|
||||
|
|
@ -950,7 +952,7 @@ class memoryview(Sequence[_I]):
|
|||
|
||||
@final
|
||||
class bool(int):
|
||||
def __new__(cls, o: object = ..., /) -> Self: ...
|
||||
def __new__(cls, o: object = False, /) -> Self: ...
|
||||
# The following overloads could be represented more elegantly with a TypeVar("_B", bool, int),
|
||||
# however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880).
|
||||
@overload
|
||||
|
|
@ -1023,7 +1025,7 @@ class slice(Generic[_StartT_co, _StopT_co, _StepT_co]):
|
|||
|
||||
@disjoint_base
|
||||
class tuple(Sequence[_T_co]):
|
||||
def __new__(cls, iterable: Iterable[_T_co] = ..., /) -> Self: ...
|
||||
def __new__(cls, iterable: Iterable[_T_co] = (), /) -> Self: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, key: object, /) -> bool: ...
|
||||
@overload
|
||||
|
|
@ -1323,7 +1325,7 @@ class range(Sequence[int]):
|
|||
@overload
|
||||
def __new__(cls, stop: SupportsIndex, /) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, start: SupportsIndex, stop: SupportsIndex, step: SupportsIndex = ..., /) -> Self: ...
|
||||
def __new__(cls, start: SupportsIndex, stop: SupportsIndex, step: SupportsIndex = 1, /) -> Self: ...
|
||||
def count(self, value: int, /) -> int: ...
|
||||
def index(self, value: int, /) -> int: ... # type: ignore[override]
|
||||
def __len__(self) -> int: ...
|
||||
|
|
@ -1348,10 +1350,10 @@ class property:
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
fget: Callable[[Any], Any] | None = ...,
|
||||
fset: Callable[[Any, Any], None] | None = ...,
|
||||
fdel: Callable[[Any], None] | None = ...,
|
||||
doc: str | None = ...,
|
||||
fget: Callable[[Any], Any] | None = None,
|
||||
fset: Callable[[Any, Any], None] | None = None,
|
||||
fdel: Callable[[Any], None] | None = None,
|
||||
doc: str | None = None,
|
||||
) -> None: ...
|
||||
def getter(self, fget: Callable[[Any], Any], /) -> property: ...
|
||||
def setter(self, fset: Callable[[Any, Any], None], /) -> property: ...
|
||||
|
|
@ -1399,7 +1401,7 @@ if sys.version_info >= (3, 10):
|
|||
@overload
|
||||
def compile(
|
||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
filename: str | ReadableBuffer | PathLike[Any],
|
||||
filename: str | bytes | PathLike[Any],
|
||||
mode: str,
|
||||
flags: Literal[0],
|
||||
dont_inherit: bool = False,
|
||||
|
|
@ -1410,7 +1412,7 @@ def compile(
|
|||
@overload
|
||||
def compile(
|
||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
filename: str | ReadableBuffer | PathLike[Any],
|
||||
filename: str | bytes | PathLike[Any],
|
||||
mode: str,
|
||||
*,
|
||||
dont_inherit: bool = False,
|
||||
|
|
@ -1420,7 +1422,7 @@ def compile(
|
|||
@overload
|
||||
def compile(
|
||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
filename: str | ReadableBuffer | PathLike[Any],
|
||||
filename: str | bytes | PathLike[Any],
|
||||
mode: str,
|
||||
flags: Literal[1024],
|
||||
dont_inherit: bool = False,
|
||||
|
|
@ -1431,7 +1433,7 @@ def compile(
|
|||
@overload
|
||||
def compile(
|
||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
filename: str | ReadableBuffer | PathLike[Any],
|
||||
filename: str | bytes | PathLike[Any],
|
||||
mode: str,
|
||||
flags: int,
|
||||
dont_inherit: bool = False,
|
||||
|
|
@ -1938,18 +1940,25 @@ def vars(object: Any = ..., /) -> dict[str, Any]: ...
|
|||
class zip(Generic[_T_co]):
|
||||
if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def __new__(cls, *, strict: bool = ...) -> zip[Any]: ...
|
||||
def __new__(cls, *, strict: bool = False) -> zip[Any]: ...
|
||||
@overload
|
||||
def __new__(cls, iter1: Iterable[_T1], /, *, strict: bool = ...) -> zip[tuple[_T1]]: ...
|
||||
def __new__(cls, iter1: Iterable[_T1], /, *, strict: bool = False) -> zip[tuple[_T1]]: ...
|
||||
@overload
|
||||
def __new__(cls, iter1: Iterable[_T1], iter2: Iterable[_T2], /, *, strict: bool = ...) -> zip[tuple[_T1, _T2]]: ...
|
||||
def __new__(cls, iter1: Iterable[_T1], iter2: Iterable[_T2], /, *, strict: bool = False) -> zip[tuple[_T1, _T2]]: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls, iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /, *, strict: bool = ...
|
||||
cls, iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /, *, strict: bool = False
|
||||
) -> zip[tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls, iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], /, *, strict: bool = ...
|
||||
cls,
|
||||
iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4],
|
||||
/,
|
||||
*,
|
||||
strict: bool = False,
|
||||
) -> zip[tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def __new__(
|
||||
|
|
@ -1961,7 +1970,7 @@ class zip(Generic[_T_co]):
|
|||
iter5: Iterable[_T5],
|
||||
/,
|
||||
*,
|
||||
strict: bool = ...,
|
||||
strict: bool = False,
|
||||
) -> zip[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def __new__(
|
||||
|
|
@ -1974,7 +1983,7 @@ class zip(Generic[_T_co]):
|
|||
iter6: Iterable[Any],
|
||||
/,
|
||||
*iterables: Iterable[Any],
|
||||
strict: bool = ...,
|
||||
strict: bool = False,
|
||||
) -> zip[tuple[Any, ...]]: ...
|
||||
else:
|
||||
@overload
|
||||
|
|
@ -2015,7 +2024,7 @@ def __import__(
|
|||
name: str,
|
||||
globals: Mapping[str, object] | None = None,
|
||||
locals: Mapping[str, object] | None = None,
|
||||
fromlist: Sequence[str] = (),
|
||||
fromlist: Sequence[str] | None = (),
|
||||
level: int = 0,
|
||||
) -> types.ModuleType: ...
|
||||
def __build_class__(func: Callable[[], CellType | Any], name: str, /, *bases: Any, metaclass: Any = ..., **kwds: Any) -> Any: ...
|
||||
|
|
@ -2049,6 +2058,10 @@ class BaseException:
|
|||
def __new__(cls, *args: Any, **kwds: Any) -> Self: ...
|
||||
def __setstate__(self, state: dict[str, Any] | None, /) -> None: ...
|
||||
def with_traceback(self, tb: TracebackType | None, /) -> Self: ...
|
||||
# Necessary for security-focused static analyzers (e.g, pysa)
|
||||
# See https://github.com/python/typeshed/pull/14900
|
||||
def __str__(self) -> str: ... # noqa: Y029
|
||||
def __repr__(self) -> str: ... # noqa: Y029
|
||||
if sys.version_info >= (3, 11):
|
||||
# only present after add_note() is called
|
||||
__notes__: list[str]
|
||||
|
|
@ -2088,8 +2101,8 @@ class AssertionError(Exception): ...
|
|||
if sys.version_info >= (3, 10):
|
||||
@disjoint_base
|
||||
class AttributeError(Exception):
|
||||
def __init__(self, *args: object, name: str | None = ..., obj: object = ...) -> None: ...
|
||||
name: str
|
||||
def __init__(self, *args: object, name: str | None = None, obj: object = None) -> None: ...
|
||||
name: str | None
|
||||
obj: object
|
||||
|
||||
else:
|
||||
|
|
@ -2100,7 +2113,7 @@ class EOFError(Exception): ...
|
|||
|
||||
@disjoint_base
|
||||
class ImportError(Exception):
|
||||
def __init__(self, *args: object, name: str | None = ..., path: str | None = ...) -> None: ...
|
||||
def __init__(self, *args: object, name: str | None = None, path: str | None = None) -> None: ...
|
||||
name: str | None
|
||||
path: str | None
|
||||
msg: str # undocumented
|
||||
|
|
@ -2113,8 +2126,8 @@ class MemoryError(Exception): ...
|
|||
if sys.version_info >= (3, 10):
|
||||
@disjoint_base
|
||||
class NameError(Exception):
|
||||
def __init__(self, *args: object, name: str | None = ...) -> None: ...
|
||||
name: str
|
||||
def __init__(self, *args: object, name: str | None = None) -> None: ...
|
||||
name: str | None
|
||||
|
||||
else:
|
||||
class NameError(Exception): ...
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ def exp(z: _C, /) -> complex: ...
|
|||
def isclose(a: _C, b: _C, *, rel_tol: SupportsFloat = 1e-09, abs_tol: SupportsFloat = 0.0) -> bool: ...
|
||||
def isinf(z: _C, /) -> bool: ...
|
||||
def isnan(z: _C, /) -> bool: ...
|
||||
def log(x: _C, base: _C = ..., /) -> complex: ...
|
||||
def log(z: _C, base: _C = ..., /) -> complex: ...
|
||||
def log10(z: _C, /) -> complex: ...
|
||||
def phase(z: _C, /) -> float: ...
|
||||
def polar(z: _C, /) -> tuple[float, float]: ...
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
import sys
|
||||
from typing import Any, Protocol, TypeVar, type_check_only
|
||||
from typing_extensions import Self
|
||||
|
||||
__all__ = ["Error", "copy", "deepcopy"]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_SR = TypeVar("_SR", bound=_SupportsReplace)
|
||||
_RT_co = TypeVar("_RT_co", covariant=True)
|
||||
|
||||
@type_check_only
|
||||
class _SupportsReplace(Protocol):
|
||||
# In reality doesn't support args, but there's no other great way to express this.
|
||||
def __replace__(self, *args: Any, **kwargs: Any) -> Self: ...
|
||||
class _SupportsReplace(Protocol[_RT_co]):
|
||||
# In reality doesn't support args, but there's no great way to express this.
|
||||
def __replace__(self, /, *_: Any, **changes: Any) -> _RT_co: ...
|
||||
|
||||
# None in CPython but non-None in Jython
|
||||
PyStringMap: Any
|
||||
|
|
@ -21,7 +20,8 @@ def copy(x: _T) -> _T: ...
|
|||
|
||||
if sys.version_info >= (3, 13):
|
||||
__all__ += ["replace"]
|
||||
def replace(obj: _SR, /, **changes: Any) -> _SR: ...
|
||||
# The types accepted by `**changes` match those of `obj.__replace__`.
|
||||
def replace(obj: _SupportsReplace[_RT_co], /, **changes: Any) -> _RT_co: ...
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ from _ctypes import (
|
|||
set_errno as set_errno,
|
||||
sizeof as sizeof,
|
||||
)
|
||||
from _typeshed import StrPath
|
||||
from _typeshed import StrPath, SupportsBool, SupportsLen
|
||||
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
|
||||
from types import GenericAlias
|
||||
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
|
||||
|
|
@ -217,7 +217,7 @@ class py_object(_CanCastTo, _SimpleCData[_T]):
|
|||
|
||||
class c_bool(_SimpleCData[bool]):
|
||||
_type_: ClassVar[Literal["?"]]
|
||||
def __init__(self, value: bool = ...) -> None: ...
|
||||
def __init__(self, value: SupportsBool | SupportsLen | None = ...) -> None: ...
|
||||
|
||||
class c_byte(_SimpleCData[int]):
|
||||
_type_: ClassVar[Literal["b"]]
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class DateHeader:
|
|||
max_count: ClassVar[Literal[1] | None]
|
||||
def init(self, name: str, *, parse_tree: TokenList, defects: Iterable[MessageDefect], datetime: _datetime) -> None: ...
|
||||
@property
|
||||
def datetime(self) -> _datetime: ...
|
||||
def datetime(self) -> _datetime | None: ...
|
||||
@staticmethod
|
||||
def value_parser(value: str) -> UnstructuredTokenList: ...
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import sys
|
||||
from _markupbase import ParserBase
|
||||
from re import Pattern
|
||||
from typing import Final
|
||||
|
|
@ -7,9 +6,8 @@ __all__ = ["HTMLParser"]
|
|||
|
||||
class HTMLParser(ParserBase):
|
||||
CDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]]
|
||||
if sys.version_info >= (3, 13):
|
||||
# Added in 3.13.6
|
||||
RCDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]]
|
||||
# Added in Python 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.6
|
||||
RCDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]]
|
||||
|
||||
def __init__(self, *, convert_charrefs: bool = True) -> None: ...
|
||||
def feed(self, data: str) -> None: ...
|
||||
|
|
@ -32,11 +30,8 @@ class HTMLParser(ParserBase):
|
|||
def parse_html_declaration(self, i: int) -> int: ... # undocumented
|
||||
def parse_pi(self, i: int) -> int: ... # undocumented
|
||||
def parse_starttag(self, i: int) -> int: ... # undocumented
|
||||
if sys.version_info >= (3, 13):
|
||||
# `escapable` parameter added in 3.13.6
|
||||
def set_cdata_mode(self, elem: str, *, escapable: bool = False) -> None: ... # undocumented
|
||||
else:
|
||||
def set_cdata_mode(self, elem: str) -> None: ... # undocumented
|
||||
# `escapable` parameter added in Python 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.6
|
||||
def set_cdata_mode(self, elem: str, *, escapable: bool = False) -> None: ... # undocumented
|
||||
rawdata: str # undocumented
|
||||
cdata_elem: str | None # undocumented
|
||||
convert_charrefs: bool # undocumented
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class InspectLoader(Loader):
|
|||
def exec_module(self, module: types.ModuleType) -> None: ...
|
||||
@staticmethod
|
||||
def source_to_code(
|
||||
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath = "<string>"
|
||||
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: bytes | StrPath = "<string>"
|
||||
) -> types.CodeType: ...
|
||||
|
||||
class ExecutionLoader(InspectLoader):
|
||||
|
|
@ -114,8 +114,8 @@ class FileLoader(_bootstrap_external.FileLoader, ResourceLoader, ExecutionLoader
|
|||
path: str
|
||||
def __init__(self, fullname: str, path: str) -> None: ...
|
||||
def get_data(self, path: str) -> bytes: ...
|
||||
def get_filename(self, name: str | None = None) -> str: ...
|
||||
def load_module(self, name: str | None = None) -> types.ModuleType: ...
|
||||
def get_filename(self, fullname: str | None = None) -> str: ...
|
||||
def load_module(self, fullname: str | None = None) -> types.ModuleType: ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
class ResourceReader(metaclass=ABCMeta):
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from contextlib import AbstractContextManager
|
|||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
from typing import Any, BinaryIO, Literal, TextIO
|
||||
from typing_extensions import TypeAlias
|
||||
from typing_extensions import TypeAlias, deprecated
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from importlib.resources.abc import Traversable
|
||||
|
|
@ -64,7 +64,11 @@ else:
|
|||
def read_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> str: ...
|
||||
def path(package: Package, resource: Resource) -> AbstractContextManager[Path, Literal[False]]: ...
|
||||
def is_resource(package: Package, name: str) -> bool: ...
|
||||
def contents(package: Package) -> Iterator[str]: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
@deprecated("Deprecated since Python 3.11. Use `files(anchor).iterdir()`.")
|
||||
def contents(package: Package) -> Iterator[str]: ...
|
||||
else:
|
||||
def contents(package: Package) -> Iterator[str]: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from importlib.resources._common import as_file as as_file
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ if sys.version_info >= (3, 13):
|
|||
from io import TextIOWrapper
|
||||
from pathlib import Path
|
||||
from typing import BinaryIO, Literal, overload
|
||||
from typing_extensions import Unpack
|
||||
from typing_extensions import Unpack, deprecated
|
||||
|
||||
def open_binary(anchor: Anchor, *path_names: StrPath) -> BinaryIO: ...
|
||||
@overload
|
||||
|
|
@ -27,4 +27,5 @@ if sys.version_info >= (3, 13):
|
|||
def read_text(anchor: Anchor, *path_names: StrPath, encoding: str | None, errors: str | None = "strict") -> str: ...
|
||||
def path(anchor: Anchor, *path_names: StrPath) -> AbstractContextManager[Path, Literal[False]]: ...
|
||||
def is_resource(anchor: Anchor, *path_names: StrPath) -> bool: ...
|
||||
@deprecated("Deprecated since Python 3.11. Use `files(anchor).iterdir()`.")
|
||||
def contents(anchor: Anchor, *path_names: StrPath) -> Iterator[str]: ...
|
||||
|
|
|
|||
|
|
@ -205,8 +205,10 @@ class itemgetter(Generic[_T_co]):
|
|||
# "tuple[int, int]" is incompatible with protocol "SupportsIndex"
|
||||
# preventing [_T_co, ...] instead of [Any, ...]
|
||||
#
|
||||
# A suspected mypy issue prevents using [..., _T] instead of [..., Any] here.
|
||||
# https://github.com/python/mypy/issues/14032
|
||||
# If we can't infer a literal key from __new__ (ie: `itemgetter[Literal[0]]` for `itemgetter(0)`),
|
||||
# then we can't annotate __call__'s return type or it'll break on tuples
|
||||
#
|
||||
# These issues are best demonstrated by the `itertools.check_itertools_recipes.unique_justseen` test.
|
||||
def __call__(self, obj: SupportsGetItem[Any, Any]) -> Any: ...
|
||||
|
||||
@final
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from cmd import Cmd
|
|||
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
from inspect import _SourceObjectType
|
||||
from linecache import _ModuleGlobals
|
||||
from rlcompleter import Completer
|
||||
from types import CodeType, FrameType, TracebackType
|
||||
from typing import IO, Any, ClassVar, Final, Literal, TypeVar
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias
|
||||
|
|
@ -200,6 +201,10 @@ class Pdb(Bdb, Cmd):
|
|||
def completenames(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... # type: ignore[override]
|
||||
if sys.version_info >= (3, 12):
|
||||
def set_convenience_variable(self, frame: FrameType, name: str, value: Any) -> None: ...
|
||||
if sys.version_info >= (3, 13) and sys.version_info < (3, 14):
|
||||
# Added in 3.13.8.
|
||||
@property
|
||||
def rlcompleter(self) -> type[Completer]: ...
|
||||
|
||||
def _select_frame(self, number: int) -> None: ...
|
||||
def _getval_except(self, arg: str, frame: FrameType | None = None) -> object: ...
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ class Misc:
|
|||
def winfo_atom(self, name: str, displayof: Literal[0] | Misc | None = 0) -> int: ...
|
||||
def winfo_atomname(self, id: int, displayof: Literal[0] | Misc | None = 0) -> str: ...
|
||||
def winfo_cells(self) -> int: ...
|
||||
def winfo_children(self) -> list[Widget]: ... # Widget because it can't be Toplevel or Tk
|
||||
def winfo_children(self) -> list[Widget | Toplevel]: ...
|
||||
def winfo_class(self) -> str: ...
|
||||
def winfo_colormapfull(self) -> bool: ...
|
||||
def winfo_containing(self, rootX: int, rootY: int, displayof: Literal[0] | Misc | None = 0) -> Misc | None: ...
|
||||
|
|
@ -3145,7 +3145,6 @@ class Scrollbar(Widget):
|
|||
def get(self) -> tuple[float, float, float, float] | tuple[float, float]: ...
|
||||
def set(self, first: float | str, last: float | str) -> None: ...
|
||||
|
||||
_TextIndex: TypeAlias = _tkinter.Tcl_Obj | str | float | Misc
|
||||
_WhatToCount: TypeAlias = Literal[
|
||||
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"
|
||||
]
|
||||
|
|
@ -3261,20 +3260,37 @@ class Text(Widget, XView, YView):
|
|||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def bbox(self, index: _TextIndex) -> tuple[int, int, int, int] | None: ... # type: ignore[override]
|
||||
def compare(self, index1: _TextIndex, op: Literal["<", "<=", "==", ">=", ">", "!="], index2: _TextIndex) -> bool: ...
|
||||
def bbox(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> tuple[int, int, int, int] | None: ... # type: ignore[override]
|
||||
def compare(
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
op: Literal["<", "<=", "==", ">=", ">", "!="],
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
) -> bool: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
@overload
|
||||
def count(self, index1: _TextIndex, index2: _TextIndex, *, return_ints: Literal[True]) -> int: ...
|
||||
@overload
|
||||
def count(
|
||||
self, index1: _TextIndex, index2: _TextIndex, arg: _WhatToCount | Literal["update"], /, *, return_ints: Literal[True]
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
*,
|
||||
return_ints: Literal[True],
|
||||
) -> int: ...
|
||||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg: _WhatToCount | Literal["update"],
|
||||
/,
|
||||
*,
|
||||
return_ints: Literal[True],
|
||||
) -> int: ...
|
||||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: Literal["update"],
|
||||
arg2: _WhatToCount,
|
||||
/,
|
||||
|
|
@ -3284,8 +3300,8 @@ class Text(Widget, XView, YView):
|
|||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: _WhatToCount,
|
||||
arg2: Literal["update"],
|
||||
/,
|
||||
|
|
@ -3294,13 +3310,20 @@ class Text(Widget, XView, YView):
|
|||
) -> int: ...
|
||||
@overload
|
||||
def count(
|
||||
self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: _WhatToCount, /, *, return_ints: Literal[True]
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: _WhatToCount,
|
||||
arg2: _WhatToCount,
|
||||
/,
|
||||
*,
|
||||
return_ints: Literal[True],
|
||||
) -> tuple[int, int]: ...
|
||||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: _WhatToCount | Literal["update"],
|
||||
arg2: _WhatToCount | Literal["update"],
|
||||
arg3: _WhatToCount | Literal["update"],
|
||||
|
|
@ -3309,12 +3332,18 @@ class Text(Widget, XView, YView):
|
|||
return_ints: Literal[True],
|
||||
) -> tuple[int, ...]: ...
|
||||
@overload
|
||||
def count(self, index1: _TextIndex, index2: _TextIndex, *, return_ints: Literal[False] = False) -> tuple[int] | None: ...
|
||||
def count(
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
*,
|
||||
return_ints: Literal[False] = False,
|
||||
) -> tuple[int] | None: ...
|
||||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg: _WhatToCount | Literal["update"],
|
||||
/,
|
||||
*,
|
||||
|
|
@ -3323,8 +3352,8 @@ class Text(Widget, XView, YView):
|
|||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: Literal["update"],
|
||||
arg2: _WhatToCount,
|
||||
/,
|
||||
|
|
@ -3334,8 +3363,8 @@ class Text(Widget, XView, YView):
|
|||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: _WhatToCount,
|
||||
arg2: Literal["update"],
|
||||
/,
|
||||
|
|
@ -3345,8 +3374,8 @@ class Text(Widget, XView, YView):
|
|||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: _WhatToCount,
|
||||
arg2: _WhatToCount,
|
||||
/,
|
||||
|
|
@ -3356,8 +3385,8 @@ class Text(Widget, XView, YView):
|
|||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: _WhatToCount | Literal["update"],
|
||||
arg2: _WhatToCount | Literal["update"],
|
||||
arg3: _WhatToCount | Literal["update"],
|
||||
|
|
@ -3366,23 +3395,50 @@ class Text(Widget, XView, YView):
|
|||
return_ints: Literal[False] = False,
|
||||
) -> tuple[int, ...]: ...
|
||||
else:
|
||||
@overload
|
||||
def count(self, index1: _TextIndex, index2: _TextIndex) -> tuple[int] | None: ...
|
||||
@overload
|
||||
def count(
|
||||
self, index1: _TextIndex, index2: _TextIndex, arg: _WhatToCount | Literal["update"], /
|
||||
self, index1: str | float | _tkinter.Tcl_Obj | Widget, index2: str | float | _tkinter.Tcl_Obj | Widget
|
||||
) -> tuple[int] | None: ...
|
||||
@overload
|
||||
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: Literal["update"], arg2: _WhatToCount, /) -> int | None: ...
|
||||
@overload
|
||||
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: Literal["update"], /) -> int | None: ...
|
||||
@overload
|
||||
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: _WhatToCount, /) -> tuple[int, int]: ...
|
||||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg: _WhatToCount | Literal["update"],
|
||||
/,
|
||||
) -> tuple[int] | None: ...
|
||||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: Literal["update"],
|
||||
arg2: _WhatToCount,
|
||||
/,
|
||||
) -> int | None: ...
|
||||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: _WhatToCount,
|
||||
arg2: Literal["update"],
|
||||
/,
|
||||
) -> int | None: ...
|
||||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: _WhatToCount,
|
||||
arg2: _WhatToCount,
|
||||
/,
|
||||
) -> tuple[int, int]: ...
|
||||
@overload
|
||||
def count(
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
arg1: _WhatToCount | Literal["update"],
|
||||
arg2: _WhatToCount | Literal["update"],
|
||||
arg3: _WhatToCount | Literal["update"],
|
||||
|
|
@ -3394,13 +3450,15 @@ class Text(Widget, XView, YView):
|
|||
def debug(self, boolean: None = None) -> bool: ...
|
||||
@overload
|
||||
def debug(self, boolean: bool) -> None: ...
|
||||
def delete(self, index1: _TextIndex, index2: _TextIndex | None = None) -> None: ...
|
||||
def dlineinfo(self, index: _TextIndex) -> tuple[int, int, int, int, int] | None: ...
|
||||
def delete(
|
||||
self, index1: str | float | _tkinter.Tcl_Obj | Widget, index2: str | float | _tkinter.Tcl_Obj | Widget | None = None
|
||||
) -> None: ...
|
||||
def dlineinfo(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> tuple[int, int, int, int, int] | None: ...
|
||||
@overload
|
||||
def dump(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex | None = None,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||
command: None = None,
|
||||
*,
|
||||
all: bool = ...,
|
||||
|
|
@ -3413,8 +3471,8 @@ class Text(Widget, XView, YView):
|
|||
@overload
|
||||
def dump(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex | None,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget | None,
|
||||
command: Callable[[str, str, str], object] | str,
|
||||
*,
|
||||
all: bool = ...,
|
||||
|
|
@ -3427,8 +3485,8 @@ class Text(Widget, XView, YView):
|
|||
@overload
|
||||
def dump(
|
||||
self,
|
||||
index1: _TextIndex,
|
||||
index2: _TextIndex | None = None,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||
*,
|
||||
command: Callable[[str, str, str], object] | str,
|
||||
all: bool = ...,
|
||||
|
|
@ -3447,21 +3505,27 @@ class Text(Widget, XView, YView):
|
|||
def edit_reset(self) -> None: ... # actually returns empty string
|
||||
def edit_separator(self) -> None: ... # actually returns empty string
|
||||
def edit_undo(self) -> None: ... # actually returns empty string
|
||||
def get(self, index1: _TextIndex, index2: _TextIndex | None = None) -> str: ...
|
||||
def get(
|
||||
self, index1: str | float | _tkinter.Tcl_Obj | Widget, index2: str | float | _tkinter.Tcl_Obj | Widget | None = None
|
||||
) -> str: ...
|
||||
@overload
|
||||
def image_cget(self, index: _TextIndex, option: Literal["image", "name"]) -> str: ...
|
||||
def image_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["image", "name"]) -> str: ...
|
||||
@overload
|
||||
def image_cget(self, index: _TextIndex, option: Literal["padx", "pady"]) -> int: ...
|
||||
def image_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["padx", "pady"]) -> int: ...
|
||||
@overload
|
||||
def image_cget(self, index: _TextIndex, option: Literal["align"]) -> Literal["baseline", "bottom", "center", "top"]: ...
|
||||
def image_cget(
|
||||
self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["align"]
|
||||
) -> Literal["baseline", "bottom", "center", "top"]: ...
|
||||
@overload
|
||||
def image_cget(self, index: _TextIndex, option: str) -> Any: ...
|
||||
def image_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: str) -> Any: ...
|
||||
@overload
|
||||
def image_configure(self, index: _TextIndex, cnf: str) -> tuple[str, str, str, str, str | int]: ...
|
||||
def image_configure(
|
||||
self, index: str | float | _tkinter.Tcl_Obj | Widget, cnf: str
|
||||
) -> tuple[str, str, str, str, str | int]: ...
|
||||
@overload
|
||||
def image_configure(
|
||||
self,
|
||||
index: _TextIndex,
|
||||
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
cnf: dict[str, Any] | None = None,
|
||||
*,
|
||||
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
||||
|
|
@ -3472,7 +3536,7 @@ class Text(Widget, XView, YView):
|
|||
) -> dict[str, tuple[str, str, str, str, str | int]] | None: ...
|
||||
def image_create(
|
||||
self,
|
||||
index: _TextIndex,
|
||||
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
cnf: dict[str, Any] | None = {},
|
||||
*,
|
||||
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
||||
|
|
@ -3482,28 +3546,36 @@ class Text(Widget, XView, YView):
|
|||
pady: float | str = ...,
|
||||
) -> str: ...
|
||||
def image_names(self) -> tuple[str, ...]: ...
|
||||
def index(self, index: _TextIndex) -> str: ...
|
||||
def insert(self, index: _TextIndex, chars: str, *args: str | list[str] | tuple[str, ...]) -> None: ...
|
||||
def index(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> str: ...
|
||||
def insert(
|
||||
self, index: str | float | _tkinter.Tcl_Obj | Widget, chars: str, *args: str | list[str] | tuple[str, ...]
|
||||
) -> None: ...
|
||||
@overload
|
||||
def mark_gravity(self, markName: str, direction: None = None) -> Literal["left", "right"]: ...
|
||||
@overload
|
||||
def mark_gravity(self, markName: str, direction: Literal["left", "right"]) -> None: ... # actually returns empty string
|
||||
def mark_names(self) -> tuple[str, ...]: ...
|
||||
def mark_set(self, markName: str, index: _TextIndex) -> None: ...
|
||||
def mark_set(self, markName: str, index: str | float | _tkinter.Tcl_Obj | Widget) -> None: ...
|
||||
def mark_unset(self, *markNames: str) -> None: ...
|
||||
def mark_next(self, index: _TextIndex) -> str | None: ...
|
||||
def mark_previous(self, index: _TextIndex) -> str | None: ...
|
||||
def mark_next(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> str | None: ...
|
||||
def mark_previous(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> str | None: ...
|
||||
# **kw of peer_create is same as the kwargs of Text.__init__
|
||||
def peer_create(self, newPathName: str | Text, cnf: dict[str, Any] = {}, **kw) -> None: ...
|
||||
def peer_names(self) -> tuple[_tkinter.Tcl_Obj, ...]: ...
|
||||
def replace(self, index1: _TextIndex, index2: _TextIndex, chars: str, *args: str | list[str] | tuple[str, ...]) -> None: ...
|
||||
def replace(
|
||||
self,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
chars: str,
|
||||
*args: str | list[str] | tuple[str, ...],
|
||||
) -> None: ...
|
||||
def scan_mark(self, x: int, y: int) -> None: ...
|
||||
def scan_dragto(self, x: int, y: int) -> None: ...
|
||||
def search(
|
||||
self,
|
||||
pattern: str,
|
||||
index: _TextIndex,
|
||||
stopindex: _TextIndex | None = None,
|
||||
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
stopindex: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||
forwards: bool | None = None,
|
||||
backwards: bool | None = None,
|
||||
exact: bool | None = None,
|
||||
|
|
@ -3512,8 +3584,10 @@ class Text(Widget, XView, YView):
|
|||
count: Variable | None = None,
|
||||
elide: bool | None = None,
|
||||
) -> str: ... # returns empty string for not found
|
||||
def see(self, index: _TextIndex) -> None: ...
|
||||
def tag_add(self, tagName: str, index1: _TextIndex, *args: _TextIndex) -> None: ...
|
||||
def see(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> None: ...
|
||||
def tag_add(
|
||||
self, tagName: str, index1: str | float | _tkinter.Tcl_Obj | Widget, *args: str | float | _tkinter.Tcl_Obj | Widget
|
||||
) -> None: ...
|
||||
# tag_bind stuff is very similar to Canvas
|
||||
@overload
|
||||
def tag_bind(
|
||||
|
|
@ -3568,33 +3642,50 @@ class Text(Widget, XView, YView):
|
|||
tag_config = tag_configure
|
||||
def tag_delete(self, first_tag_name: str, /, *tagNames: str) -> None: ... # error if no tag names given
|
||||
def tag_lower(self, tagName: str, belowThis: str | None = None) -> None: ...
|
||||
def tag_names(self, index: _TextIndex | None = None) -> tuple[str, ...]: ...
|
||||
def tag_names(self, index: str | float | _tkinter.Tcl_Obj | Widget | None = None) -> tuple[str, ...]: ...
|
||||
def tag_nextrange(
|
||||
self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = None
|
||||
self,
|
||||
tagName: str,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||
) -> tuple[str, str] | tuple[()]: ...
|
||||
def tag_prevrange(
|
||||
self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = None
|
||||
self,
|
||||
tagName: str,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||
) -> tuple[str, str] | tuple[()]: ...
|
||||
def tag_raise(self, tagName: str, aboveThis: str | None = None) -> None: ...
|
||||
def tag_ranges(self, tagName: str) -> tuple[_tkinter.Tcl_Obj, ...]: ...
|
||||
# tag_remove and tag_delete are different
|
||||
def tag_remove(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = None) -> None: ...
|
||||
def tag_remove(
|
||||
self,
|
||||
tagName: str,
|
||||
index1: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
index2: str | float | _tkinter.Tcl_Obj | Widget | None = None,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def window_cget(self, index: _TextIndex, option: Literal["padx", "pady"]) -> int: ...
|
||||
def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["padx", "pady"]) -> int: ...
|
||||
@overload
|
||||
def window_cget(self, index: _TextIndex, option: Literal["stretch"]) -> bool: ... # actually returns Literal[0, 1]
|
||||
def window_cget(
|
||||
self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["stretch"]
|
||||
) -> bool: ... # actually returns Literal[0, 1]
|
||||
@overload
|
||||
def window_cget(self, index: _TextIndex, option: Literal["align"]) -> Literal["baseline", "bottom", "center", "top"]: ...
|
||||
def window_cget(
|
||||
self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["align"]
|
||||
) -> Literal["baseline", "bottom", "center", "top"]: ...
|
||||
@overload # window is set to a widget, but read as the string name.
|
||||
def window_cget(self, index: _TextIndex, option: Literal["create", "window"]) -> str: ...
|
||||
def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["create", "window"]) -> str: ...
|
||||
@overload
|
||||
def window_cget(self, index: _TextIndex, option: str) -> Any: ...
|
||||
def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: str) -> Any: ...
|
||||
@overload
|
||||
def window_configure(self, index: _TextIndex, cnf: str) -> tuple[str, str, str, str, str | int]: ...
|
||||
def window_configure(
|
||||
self, index: str | float | _tkinter.Tcl_Obj | Widget, cnf: str
|
||||
) -> tuple[str, str, str, str, str | int]: ...
|
||||
@overload
|
||||
def window_configure(
|
||||
self,
|
||||
index: _TextIndex,
|
||||
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
cnf: dict[str, Any] | None = None,
|
||||
*,
|
||||
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
||||
|
|
@ -3607,7 +3698,7 @@ class Text(Widget, XView, YView):
|
|||
window_config = window_configure
|
||||
def window_create(
|
||||
self,
|
||||
index: _TextIndex,
|
||||
index: str | float | _tkinter.Tcl_Obj | Widget,
|
||||
cnf: dict[str, Any] | None = {},
|
||||
*,
|
||||
align: Literal["baseline", "bottom", "center", "top"] = ...,
|
||||
|
|
|
|||
|
|
@ -221,16 +221,20 @@ class Terminator(Exception): ...
|
|||
class TurtleGraphicsError(Exception): ...
|
||||
|
||||
class Shape:
|
||||
def __init__(self, type_: str, data: _PolygonCoords | PhotoImage | None = None) -> None: ...
|
||||
def __init__(
|
||||
self, type_: Literal["polygon", "image", "compound"], data: _PolygonCoords | PhotoImage | None = None
|
||||
) -> None: ...
|
||||
def addcomponent(self, poly: _PolygonCoords, fill: _Color, outline: _Color | None = None) -> None: ...
|
||||
|
||||
class TurtleScreen(TurtleScreenBase):
|
||||
def __init__(self, cv: Canvas, mode: str = "standard", colormode: float = 1.0, delay: int = 10) -> None: ...
|
||||
def __init__(
|
||||
self, cv: Canvas, mode: Literal["standard", "logo", "world"] = "standard", colormode: float = 1.0, delay: int = 10
|
||||
) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
@overload
|
||||
def mode(self, mode: None = None) -> str: ...
|
||||
@overload
|
||||
def mode(self, mode: str) -> None: ...
|
||||
def mode(self, mode: Literal["standard", "logo", "world"]) -> None: ...
|
||||
def setworldcoordinates(self, llx: float, lly: float, urx: float, ury: float) -> None: ...
|
||||
def register_shape(self, name: str, shape: _PolygonCoords | Shape | None = None) -> None: ...
|
||||
@overload
|
||||
|
|
@ -262,7 +266,7 @@ class TurtleScreen(TurtleScreenBase):
|
|||
def window_height(self) -> int: ...
|
||||
def getcanvas(self) -> Canvas: ...
|
||||
def getshapes(self) -> list[str]: ...
|
||||
def onclick(self, fun: Callable[[float, float], object], btn: int = 1, add: Any | None = None) -> None: ...
|
||||
def onclick(self, fun: Callable[[float, float], object], btn: int = 1, add: bool | None = None) -> None: ...
|
||||
def onkey(self, fun: Callable[[], object], key: str) -> None: ...
|
||||
def listen(self, xdummy: float | None = None, ydummy: float | None = None) -> None: ...
|
||||
def ontimer(self, fun: Callable[[], object], t: int = 0) -> None: ...
|
||||
|
|
@ -289,7 +293,7 @@ class TNavigator:
|
|||
DEFAULT_MODE: str
|
||||
DEFAULT_ANGLEOFFSET: int
|
||||
DEFAULT_ANGLEORIENT: int
|
||||
def __init__(self, mode: str = "standard") -> None: ...
|
||||
def __init__(self, mode: Literal["standard", "logo", "world"] = "standard") -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def degrees(self, fullcircle: float = 360.0) -> None: ...
|
||||
def radians(self) -> None: ...
|
||||
|
|
@ -333,11 +337,11 @@ class TNavigator:
|
|||
seth = setheading
|
||||
|
||||
class TPen:
|
||||
def __init__(self, resizemode: str = "noresize") -> None: ...
|
||||
def __init__(self, resizemode: Literal["auto", "user", "noresize"] = "noresize") -> None: ...
|
||||
@overload
|
||||
def resizemode(self, rmode: None = None) -> str: ...
|
||||
@overload
|
||||
def resizemode(self, rmode: str) -> None: ...
|
||||
def resizemode(self, rmode: Literal["auto", "user", "noresize"]) -> None: ...
|
||||
@overload
|
||||
def pensize(self, width: None = None) -> int: ...
|
||||
@overload
|
||||
|
|
@ -389,7 +393,7 @@ class TPen:
|
|||
fillcolor: _Color = ...,
|
||||
pensize: int = ...,
|
||||
speed: int = ...,
|
||||
resizemode: str = ...,
|
||||
resizemode: Literal["auto", "user", "noresize"] = ...,
|
||||
stretchfactor: tuple[float, float] = ...,
|
||||
outline: int = ...,
|
||||
tilt: float = ...,
|
||||
|
|
@ -524,7 +528,7 @@ def clear() -> None: ...
|
|||
@overload
|
||||
def mode(mode: None = None) -> str: ...
|
||||
@overload
|
||||
def mode(mode: str) -> None: ...
|
||||
def mode(mode: Literal["standard", "logo", "world"]) -> None: ...
|
||||
def setworldcoordinates(llx: float, lly: float, urx: float, ury: float) -> None: ...
|
||||
def register_shape(name: str, shape: _PolygonCoords | Shape | None = None) -> None: ...
|
||||
@overload
|
||||
|
|
@ -557,7 +561,7 @@ def window_width() -> int: ...
|
|||
def window_height() -> int: ...
|
||||
def getcanvas() -> Canvas: ...
|
||||
def getshapes() -> list[str]: ...
|
||||
def onclick(fun: Callable[[float, float], object], btn: int = 1, add: Any | None = None) -> None: ...
|
||||
def onclick(fun: Callable[[float, float], object], btn: int = 1, add: bool | None = None) -> None: ...
|
||||
def onkey(fun: Callable[[], object], key: str) -> None: ...
|
||||
def listen(xdummy: float | None = None, ydummy: float | None = None) -> None: ...
|
||||
def ontimer(fun: Callable[[], object], t: int = 0) -> None: ...
|
||||
|
|
@ -634,7 +638,7 @@ seth = setheading
|
|||
@overload
|
||||
def resizemode(rmode: None = None) -> str: ...
|
||||
@overload
|
||||
def resizemode(rmode: str) -> None: ...
|
||||
def resizemode(rmode: Literal["auto", "user", "noresize"]) -> None: ...
|
||||
@overload
|
||||
def pensize(width: None = None) -> int: ...
|
||||
@overload
|
||||
|
|
@ -683,7 +687,7 @@ def pen(
|
|||
fillcolor: _Color = ...,
|
||||
pensize: int = ...,
|
||||
speed: int = ...,
|
||||
resizemode: str = ...,
|
||||
resizemode: Literal["auto", "user", "noresize"] = ...,
|
||||
stretchfactor: tuple[float, float] = ...,
|
||||
outline: int = ...,
|
||||
tilt: float = ...,
|
||||
|
|
@ -772,8 +776,8 @@ def getturtle() -> Turtle: ...
|
|||
|
||||
getpen = getturtle
|
||||
|
||||
def onrelease(fun: Callable[[float, float], object], btn: int = 1, add: Any | None = None) -> None: ...
|
||||
def ondrag(fun: Callable[[float, float], object], btn: int = 1, add: Any | None = None) -> None: ...
|
||||
def onrelease(fun: Callable[[float, float], object], btn: int = 1, add: bool | None = None) -> None: ...
|
||||
def ondrag(fun: Callable[[float, float], object], btn: int = 1, add: bool | None = None) -> None: ...
|
||||
def undo() -> None: ...
|
||||
|
||||
turtlesize = shapesize
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ if sys.version_info >= (3, 13):
|
|||
|
||||
_T1 = TypeVar("_T1")
|
||||
_T2 = TypeVar("_T2")
|
||||
_KT = TypeVar("_KT")
|
||||
_KT_co = TypeVar("_KT_co", covariant=True)
|
||||
_VT_co = TypeVar("_VT_co", covariant=True)
|
||||
|
||||
# Make sure this class definition stays roughly in line with `builtins.function`
|
||||
|
|
@ -309,27 +309,27 @@ class CodeType:
|
|||
__replace__ = replace
|
||||
|
||||
@final
|
||||
class MappingProxyType(Mapping[_KT, _VT_co]):
|
||||
class MappingProxyType(Mapping[_KT_co, _VT_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments]
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __new__(cls, mapping: SupportsKeysAndGetItem[_KT, _VT_co]) -> Self: ...
|
||||
def __getitem__(self, key: _KT, /) -> _VT_co: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __new__(cls, mapping: SupportsKeysAndGetItem[_KT_co, _VT_co]) -> Self: ...
|
||||
def __getitem__(self, key: _KT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
||||
def __iter__(self) -> Iterator[_KT_co]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def copy(self) -> dict[_KT, _VT_co]: ...
|
||||
def keys(self) -> KeysView[_KT]: ...
|
||||
def copy(self) -> dict[_KT_co, _VT_co]: ...
|
||||
def keys(self) -> KeysView[_KT_co]: ...
|
||||
def values(self) -> ValuesView[_VT_co]: ...
|
||||
def items(self) -> ItemsView[_KT, _VT_co]: ...
|
||||
def items(self) -> ItemsView[_KT_co, _VT_co]: ...
|
||||
@overload
|
||||
def get(self, key: _KT, /) -> _VT_co | None: ...
|
||||
def get(self, key: _KT_co, /) -> _VT_co | None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
|
||||
@overload
|
||||
def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
|
||||
def get(self, key: _KT_co, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
|
||||
@overload
|
||||
def get(self, key: _KT, default: _T2, /) -> _VT_co | _T2: ...
|
||||
def get(self, key: _KT_co, default: _T2, /) -> _VT_co | _T2: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...
|
||||
def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...
|
||||
def __reversed__(self) -> Iterator[_KT_co]: ...
|
||||
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT_co | _T1, _VT_co | _T2]: ...
|
||||
def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT_co | _T1, _VT_co | _T2]: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
@disjoint_base
|
||||
|
|
@ -462,8 +462,13 @@ class CoroutineType(Coroutine[_YieldT_co, _SendT_nd_contra, _ReturnT_nd_co]):
|
|||
def cr_await(self) -> Any | None: ...
|
||||
@property
|
||||
def cr_code(self) -> CodeType: ...
|
||||
@property
|
||||
def cr_frame(self) -> FrameType: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
@property
|
||||
def cr_frame(self) -> FrameType | None: ...
|
||||
else:
|
||||
@property
|
||||
def cr_frame(self) -> FrameType: ...
|
||||
|
||||
@property
|
||||
def cr_running(self) -> bool: ...
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -1133,14 +1133,23 @@ if sys.version_info >= (3, 10):
|
|||
def _type_repr(obj: object) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
_TypeParameter: typing_extensions.TypeAlias = (
|
||||
TypeVar
|
||||
| typing_extensions.TypeVar
|
||||
| ParamSpec
|
||||
| typing_extensions.ParamSpec
|
||||
| TypeVarTuple
|
||||
| typing_extensions.TypeVarTuple
|
||||
)
|
||||
|
||||
def override(method: _F, /) -> _F: ...
|
||||
@final
|
||||
class TypeAliasType:
|
||||
def __new__(cls, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()) -> Self: ...
|
||||
def __new__(cls, name: str, value: Any, *, type_params: tuple[_TypeParameter, ...] = ()) -> Self: ...
|
||||
@property
|
||||
def __value__(self) -> Any: ... # AnnotationForm
|
||||
@property
|
||||
def __type_params__(self) -> tuple[TypeVar | ParamSpec | TypeVarTuple, ...]: ...
|
||||
def __type_params__(self) -> tuple[_TypeParameter, ...]: ...
|
||||
@property
|
||||
def __parameters__(self) -> tuple[Any, ...]: ... # AnnotationForm
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
|||
__readonly_keys__: ClassVar[frozenset[str]]
|
||||
__mutable_keys__: ClassVar[frozenset[str]]
|
||||
# PEP 728
|
||||
__closed__: ClassVar[bool]
|
||||
__closed__: ClassVar[bool | None]
|
||||
__extra_items__: ClassVar[AnnotationForm]
|
||||
def copy(self) -> Self: ...
|
||||
# Using Never so that only calls using mypy plugin hook that specialize the signature
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class Element(Generic[_Tag]):
|
|||
def __init__(self, tag: _Tag, attrib: dict[str, str] = {}, **extra: str) -> None: ...
|
||||
def append(self, subelement: Element[Any], /) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def extend(self, elements: Iterable[Element], /) -> None: ...
|
||||
def extend(self, elements: Iterable[Element[Any]], /) -> None: ...
|
||||
def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ...
|
||||
def findall(self, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ...
|
||||
@overload
|
||||
|
|
@ -104,7 +104,7 @@ class Element(Generic[_Tag]):
|
|||
def get(self, key: str, default: None = None) -> str | None: ...
|
||||
@overload
|
||||
def get(self, key: str, default: _T) -> str | _T: ...
|
||||
def insert(self, index: int, subelement: Element, /) -> None: ...
|
||||
def insert(self, index: int, subelement: Element[Any], /) -> None: ...
|
||||
def items(self) -> ItemsView[str, str]: ...
|
||||
def iter(self, tag: str | None = None) -> Generator[Element, None, None]: ...
|
||||
@overload
|
||||
|
|
@ -115,7 +115,7 @@ class Element(Generic[_Tag]):
|
|||
def keys(self) -> dict_keys[str, str]: ...
|
||||
# makeelement returns the type of self in Python impl, but not in C impl
|
||||
def makeelement(self, tag: _OtherTag, attrib: dict[str, str], /) -> Element[_OtherTag]: ...
|
||||
def remove(self, subelement: Element, /) -> None: ...
|
||||
def remove(self, subelement: Element[Any], /) -> None: ...
|
||||
def set(self, key: str, value: str, /) -> None: ...
|
||||
def __copy__(self) -> Element[_Tag]: ... # returns the type of self in Python impl, but not in C impl
|
||||
def __deepcopy__(self, memo: Any, /) -> Element: ... # Only exists in C impl
|
||||
|
|
@ -128,15 +128,15 @@ class Element(Generic[_Tag]):
|
|||
# Doesn't actually exist at runtime, but instance of the class are indeed iterable due to __getitem__.
|
||||
def __iter__(self) -> Iterator[Element]: ...
|
||||
@overload
|
||||
def __setitem__(self, key: SupportsIndex, value: Element, /) -> None: ...
|
||||
def __setitem__(self, key: SupportsIndex, value: Element[Any], /) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, key: slice, value: Iterable[Element], /) -> None: ...
|
||||
def __setitem__(self, key: slice, value: Iterable[Element[Any]], /) -> None: ...
|
||||
|
||||
# Doesn't really exist in earlier versions, where __len__ is called implicitly instead
|
||||
@deprecated("Testing an element's truth value is deprecated.")
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
def SubElement(parent: Element, tag: str, attrib: dict[str, str] = ..., **extra: str) -> Element: ...
|
||||
def SubElement(parent: Element[Any], tag: str, attrib: dict[str, str] = ..., **extra: str) -> Element: ...
|
||||
def Comment(text: str | None = None) -> Element[_ElementCallable]: ...
|
||||
def ProcessingInstruction(target: str, text: str | None = None) -> Element[_ElementCallable]: ...
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ class QName:
|
|||
_Root = TypeVar("_Root", Element, Element | None, default=Element | None)
|
||||
|
||||
class ElementTree(Generic[_Root]):
|
||||
def __init__(self, element: Element | None = None, file: _FileRead | None = None) -> None: ...
|
||||
def __init__(self, element: Element[Any] | None = None, file: _FileRead | None = None) -> None: ...
|
||||
def getroot(self) -> _Root: ...
|
||||
def parse(self, source: _FileRead, parser: XMLParser | None = None) -> Element: ...
|
||||
def iter(self, tag: str | None = None) -> Generator[Element, None, None]: ...
|
||||
|
|
@ -186,7 +186,7 @@ HTML_EMPTY: Final[set[str]]
|
|||
def register_namespace(prefix: str, uri: str) -> None: ...
|
||||
@overload
|
||||
def tostring(
|
||||
element: Element,
|
||||
element: Element[Any],
|
||||
encoding: None = None,
|
||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||
*,
|
||||
|
|
@ -196,7 +196,7 @@ def tostring(
|
|||
) -> bytes: ...
|
||||
@overload
|
||||
def tostring(
|
||||
element: Element,
|
||||
element: Element[Any],
|
||||
encoding: Literal["unicode"],
|
||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||
*,
|
||||
|
|
@ -206,7 +206,7 @@ def tostring(
|
|||
) -> str: ...
|
||||
@overload
|
||||
def tostring(
|
||||
element: Element,
|
||||
element: Element[Any],
|
||||
encoding: str,
|
||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||
*,
|
||||
|
|
@ -216,7 +216,7 @@ def tostring(
|
|||
) -> Any: ...
|
||||
@overload
|
||||
def tostringlist(
|
||||
element: Element,
|
||||
element: Element[Any],
|
||||
encoding: None = None,
|
||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||
*,
|
||||
|
|
@ -226,7 +226,7 @@ def tostringlist(
|
|||
) -> list[bytes]: ...
|
||||
@overload
|
||||
def tostringlist(
|
||||
element: Element,
|
||||
element: Element[Any],
|
||||
encoding: Literal["unicode"],
|
||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||
*,
|
||||
|
|
@ -236,7 +236,7 @@ def tostringlist(
|
|||
) -> list[str]: ...
|
||||
@overload
|
||||
def tostringlist(
|
||||
element: Element,
|
||||
element: Element[Any],
|
||||
encoding: str,
|
||||
method: Literal["xml", "html", "text", "c14n"] | None = None,
|
||||
*,
|
||||
|
|
@ -244,8 +244,8 @@ def tostringlist(
|
|||
default_namespace: str | None = None,
|
||||
short_empty_elements: bool = True,
|
||||
) -> list[Any]: ...
|
||||
def dump(elem: Element | ElementTree[Any]) -> None: ...
|
||||
def indent(tree: Element | ElementTree[Any], space: str = " ", level: int = 0) -> None: ...
|
||||
def dump(elem: Element[Any] | ElementTree[Any]) -> None: ...
|
||||
def indent(tree: Element[Any] | ElementTree[Any], space: str = " ", level: int = 0) -> None: ...
|
||||
def parse(source: _FileRead, parser: XMLParser[Any] | None = None) -> ElementTree[Element]: ...
|
||||
|
||||
# This class is defined inside the body of iterparse
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version = "~= 1.6.4"
|
||||
version = "1.6.5"
|
||||
upstream_repository = "https://github.com/lepture/authlib"
|
||||
requires = ["cryptography"]
|
||||
partial_stub = true
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
from _typeshed import Incomplete
|
||||
|
||||
class JsonWebSignature:
|
||||
REGISTERED_HEADER_PARAMETER_NAMES: Incomplete
|
||||
ALGORITHMS_REGISTRY: Incomplete
|
||||
REGISTERED_HEADER_PARAMETER_NAMES: frozenset[str]
|
||||
MAX_CONTENT_LENGTH: int
|
||||
ALGORITHMS_REGISTRY: dict[str, Incomplete]
|
||||
def __init__(self, algorithms=None, private_headers=None) -> None: ...
|
||||
@classmethod
|
||||
def register_algorithm(cls, algorithm) -> None: ...
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ class JWEZipAlgorithm:
|
|||
description: Incomplete
|
||||
algorithm_type: str
|
||||
algorithm_location: str
|
||||
def compress(self, s) -> None: ...
|
||||
def decompress(self, s) -> None: ...
|
||||
def compress(self, s: bytes) -> bytes | None: ...
|
||||
def decompress(self, s: bytes) -> bytes | None: ...
|
||||
|
||||
class JWESharedHeader(dict[str, object]):
|
||||
protected: Incomplete
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
from typing import Final
|
||||
|
||||
from authlib.jose.rfc7516 import JWEZipAlgorithm
|
||||
|
||||
GZIP_HEAD: Final[bytes]
|
||||
MAX_SIZE: Final = 256000
|
||||
|
||||
class DeflateZipAlgorithm(JWEZipAlgorithm):
|
||||
name: str
|
||||
description: str
|
||||
def compress(self, s): ...
|
||||
def decompress(self, s): ...
|
||||
def compress(self, s: bytes) -> bytes: ...
|
||||
def decompress(self, s: bytes) -> bytes: ...
|
||||
|
||||
def register_jwe_rfc7518() -> None: ...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import Final
|
||||
|
||||
from authlib.jose import JWTClaims
|
||||
|
||||
class ClientRegistrationEndpoint:
|
||||
ENDPOINT_NAME: Final = "client_registration"
|
||||
software_statement_alg_values_supported: Incomplete
|
||||
|
|
@ -10,12 +12,12 @@ class ClientRegistrationEndpoint:
|
|||
def __call__(self, request) -> dict[Incomplete, Incomplete]: ...
|
||||
def create_registration_response(self, request): ...
|
||||
def extract_client_metadata(self, request): ...
|
||||
def extract_software_statement(self, software_statement, request): ...
|
||||
def generate_client_info(self): ...
|
||||
def extract_software_statement(self, software_statement, request) -> JWTClaims: ...
|
||||
def generate_client_info(self, request) -> dict[str, Incomplete]: ...
|
||||
def generate_client_registration_info(self, client, request) -> None: ...
|
||||
def create_endpoint_request(self, request): ...
|
||||
def generate_client_id(self): ...
|
||||
def generate_client_secret(self): ...
|
||||
def generate_client_id(self, request) -> str: ...
|
||||
def generate_client_secret(self, request) -> str: ...
|
||||
def get_server_metadata(self) -> None: ...
|
||||
def authenticate_token(self, request) -> None: ...
|
||||
def resolve_public_key(self, request) -> None: ...
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
from typing import Final
|
||||
|
||||
BOARD: Final = 10
|
||||
BCM: Final = 11
|
||||
TEGRA_SOC: Final = 1000
|
||||
CVM: Final = 1001
|
||||
|
||||
PUD_OFF: Final = 20
|
||||
PUD_DOWN: Final = 21
|
||||
PUD_UP: Final = 22
|
||||
|
||||
HIGH: Final = 1
|
||||
LOW: Final = 0
|
||||
|
||||
RISING: Final = 31
|
||||
FALLING: Final = 32
|
||||
BOTH: Final = 33
|
||||
|
||||
UNKNOWN: Final = -1
|
||||
OUT: Final = 0
|
||||
IN: Final = 1
|
||||
HARD_PWM: Final = 43
|
||||
|
|
@ -1,26 +1,7 @@
|
|||
from collections.abc import Callable, Sequence
|
||||
from typing import Final, Literal
|
||||
from typing import Literal
|
||||
|
||||
BOARD: Final = 10
|
||||
BCM: Final = 11
|
||||
TEGRA_SOC: Final = 1000
|
||||
CVM: Final = 1001
|
||||
|
||||
PUD_OFF: Final = 20
|
||||
PUD_DOWN: Final = 21
|
||||
PUD_UP: Final = 22
|
||||
|
||||
HIGH: Final = 1
|
||||
LOW: Final = 0
|
||||
|
||||
RISING: Final = 31
|
||||
FALLING: Final = 32
|
||||
BOTH: Final = 33
|
||||
|
||||
UNKNOWN: Final = -1
|
||||
OUT: Final = 0
|
||||
IN: Final = 1
|
||||
HARD_PWM: Final = 43
|
||||
from .constants import *
|
||||
|
||||
model = ...
|
||||
JETSON_INFO = ...
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import ctypes
|
||||
from dataclasses import dataclass
|
||||
from typing import Final, Literal
|
||||
|
||||
from .gpio_pin_data import ChannelInfo
|
||||
|
|
@ -70,3 +71,13 @@ def request_handle(line_offset: int, direction: Literal[0, 1], initial: Literal[
|
|||
def request_event(line_offset: int, edge: int, consumer: str) -> gpioevent_request: ...
|
||||
def get_value(line_handle: int) -> int: ...
|
||||
def set_value(line_handle: int, value: int) -> None: ...
|
||||
@dataclass
|
||||
class PadCtlRegister:
|
||||
is_gpio: bool
|
||||
is_input: bool
|
||||
is_tristate: bool
|
||||
def __init__(self, value: int) -> None: ...
|
||||
@property
|
||||
def is_bidi(self) -> bool: ...
|
||||
|
||||
def check_pinmux(ch_info: ChannelInfo, direction: int) -> None: ...
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ JETSON_THOR_REFERENCE: Final = "JETSON_THOR_REFERENCE"
|
|||
|
||||
JETSON_MODELS: list[str]
|
||||
|
||||
JETSON_ORIN_NX_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]]
|
||||
JETSON_ORIN_NX_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None, int]]
|
||||
compats_jetson_orins_nx: Sequence[str]
|
||||
compats_jetson_orins_nano: Sequence[str]
|
||||
|
||||
JETSON_ORIN_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]]
|
||||
JETSON_ORIN_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None, int]]
|
||||
compats_jetson_orins: Sequence[str]
|
||||
|
||||
CLARA_AGX_XAVIER_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]]
|
||||
|
|
@ -49,8 +49,27 @@ compats_jetson_thor_reference: Sequence[str]
|
|||
jetson_gpio_data: dict[str, tuple[list[tuple[int, str, str, int, int, str, str, str | None, int | None]], dict[str, Any]]]
|
||||
|
||||
class ChannelInfo:
|
||||
channel: int
|
||||
chip_fd: int | None
|
||||
line_handle: int | None
|
||||
line_offset: int
|
||||
direction: int | None
|
||||
edge: int | None
|
||||
consumer: str
|
||||
gpio_name: str
|
||||
gpio_chip: str
|
||||
pwm_chip_dir: str
|
||||
pwm_id: int
|
||||
reg_addr: int | None
|
||||
def __init__(
|
||||
self, channel: int, line_offset: int, gpio_name: str, gpio_chip: str, pwm_chip_dir: str, pwm_id: int
|
||||
self,
|
||||
channel: int,
|
||||
line_offset: int,
|
||||
gpio_name: str,
|
||||
gpio_chip: str,
|
||||
pwm_chip_dir: str,
|
||||
pwm_id: int,
|
||||
reg_addr: int | None = None,
|
||||
) -> None: ...
|
||||
|
||||
ids_warned: bool
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
from collections.abc import Iterable
|
||||
|
||||
def lookup_mux_register(
|
||||
gpio_pin: int, pin_defs: Iterable[tuple[int, str, str, int, int, str, str, str | None, int | None, int]]
|
||||
) -> int: ...
|
||||
def main() -> None: ...
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
version = "~=2.1.11"
|
||||
version = "2.1.12"
|
||||
upstream_repository = "https://github.com/NVIDIA/jetson-gpio"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import sys
|
|||
import urllib.request
|
||||
from _typeshed import Incomplete, SupportsKeysAndGetItem
|
||||
from typing import Any, TypeVar
|
||||
from typing_extensions import override
|
||||
|
||||
import socks
|
||||
|
||||
|
|
@ -33,7 +32,6 @@ class SocksiPyConnection(http.client.HTTPConnection): # undocumented
|
|||
source_address: tuple[str, int] | None = None,
|
||||
blocksize: int = 8192,
|
||||
) -> None: ...
|
||||
@override
|
||||
def connect(self) -> None: ...
|
||||
|
||||
class SocksiPyConnectionS(http.client.HTTPSConnection): # undocumented
|
||||
|
|
@ -77,7 +75,6 @@ class SocksiPyConnectionS(http.client.HTTPSConnection): # undocumented
|
|||
blocksize: int = 8192,
|
||||
) -> None: ...
|
||||
|
||||
@override
|
||||
def connect(self) -> None: ...
|
||||
|
||||
class SocksiPyHandler(urllib.request.HTTPHandler, urllib.request.HTTPSHandler):
|
||||
|
|
@ -96,7 +93,5 @@ class SocksiPyHandler(urllib.request.HTTPHandler, urllib.request.HTTPSHandler):
|
|||
blocksize: int = 8192,
|
||||
**kwargs: Any, # any additional arguments to `SocksiPyConnection` or `SocksiPyConnectionS`
|
||||
) -> None: ...
|
||||
@override
|
||||
def http_open(self, req: urllib.request.Request) -> http.client.HTTPResponse: ... # undocumented
|
||||
@override
|
||||
def https_open(self, req: urllib.request.Request) -> http.client.HTTPResponse: ... # undocumented
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version = "24.1.*"
|
||||
version = "25.1.*"
|
||||
upstream_repository = "https://github.com/Tinche/aiofiles"
|
||||
|
||||
[tool.stubtest]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ from typing_extensions import Self
|
|||
_T = TypeVar("_T")
|
||||
_V_co = TypeVar("_V_co", covariant=True)
|
||||
|
||||
def wrap(func: Callable[..., _T]) -> Callable[..., Awaitable[_T]]: ...
|
||||
|
||||
class AsyncBase(Generic[_T]):
|
||||
def __init__(self, file: TextIO | BinaryIO | None, loop: AbstractEventLoop | None, executor: Executor | None) -> None: ...
|
||||
def __aiter__(self) -> Self: ...
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from os import _ScandirIterator, stat_result
|
|||
from typing import AnyStr, overload
|
||||
|
||||
from aiofiles import ospath
|
||||
from aiofiles.ospath import wrap as wrap
|
||||
from aiofiles.base import wrap as wrap
|
||||
|
||||
__all__ = [
|
||||
"path",
|
||||
|
|
|
|||
|
|
@ -1,13 +1,24 @@
|
|||
from _typeshed import FileDescriptorOrPath
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from collections.abc import Awaitable, Callable
|
||||
from concurrent.futures import Executor
|
||||
from os import PathLike
|
||||
from typing import AnyStr, TypeVar
|
||||
from typing import AnyStr
|
||||
|
||||
_R = TypeVar("_R")
|
||||
__all__ = [
|
||||
"abspath",
|
||||
"getatime",
|
||||
"getctime",
|
||||
"getmtime",
|
||||
"getsize",
|
||||
"exists",
|
||||
"isdir",
|
||||
"isfile",
|
||||
"islink",
|
||||
"ismount",
|
||||
"samefile",
|
||||
"sameopenfile",
|
||||
]
|
||||
|
||||
def wrap(func: Callable[..., _R]) -> Callable[..., Awaitable[_R]]: ...
|
||||
async def exists(
|
||||
path: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Executor | None = ...
|
||||
) -> bool: ...
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
version = "4.38.*"
|
||||
version = "4.39.*"
|
||||
upstream_repository = "https://github.com/braintree/braintree_python"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,13 @@ from braintree.amex_express_checkout_card import AmexExpressCheckoutCard as Amex
|
|||
from braintree.android_pay_card import AndroidPayCard as AndroidPayCard
|
||||
from braintree.apple_pay_card import ApplePayCard as ApplePayCard
|
||||
from braintree.apple_pay_gateway import ApplePayGateway as ApplePayGateway
|
||||
from braintree.bank_account_instant_verification_gateway import (
|
||||
BankAccountInstantVerificationGateway as BankAccountInstantVerificationGateway,
|
||||
)
|
||||
from braintree.bank_account_instant_verification_jwt import BankAccountInstantVerificationJwt as BankAccountInstantVerificationJwt
|
||||
from braintree.bank_account_instant_verification_jwt_request import (
|
||||
BankAccountInstantVerificationJwtRequest as BankAccountInstantVerificationJwtRequest,
|
||||
)
|
||||
from braintree.blik_alias import BlikAlias as BlikAlias
|
||||
from braintree.braintree_gateway import BraintreeGateway as BraintreeGateway
|
||||
from braintree.client_token import ClientToken as ClientToken
|
||||
|
|
@ -62,10 +69,12 @@ from braintree.paypal_payment_resource import PayPalPaymentResource as PayPalPay
|
|||
from braintree.plan import Plan as Plan
|
||||
from braintree.plan_gateway import PlanGateway as PlanGateway
|
||||
from braintree.processor_response_types import ProcessorResponseTypes as ProcessorResponseTypes
|
||||
from braintree.receiver import Receiver as Receiver
|
||||
from braintree.resource_collection import ResourceCollection as ResourceCollection
|
||||
from braintree.risk_data import RiskData as RiskData
|
||||
from braintree.samsung_pay_card import SamsungPayCard as SamsungPayCard
|
||||
from braintree.search import Search as Search
|
||||
from braintree.sender import Sender as Sender
|
||||
from braintree.sepa_direct_debit_account import SepaDirectDebitAccount as SepaDirectDebitAccount
|
||||
from braintree.settlement_batch_summary import SettlementBatchSummary as SettlementBatchSummary
|
||||
from braintree.signature_service import SignatureService as SignatureService
|
||||
|
|
@ -84,9 +93,11 @@ from braintree.transaction_details import TransactionDetails as TransactionDetai
|
|||
from braintree.transaction_gateway import TransactionGateway as TransactionGateway
|
||||
from braintree.transaction_line_item import TransactionLineItem as TransactionLineItem
|
||||
from braintree.transaction_search import TransactionSearch as TransactionSearch
|
||||
from braintree.transaction_us_bank_account_request import TransactionUsBankAccountRequest as TransactionUsBankAccountRequest
|
||||
from braintree.transfer import Transfer as Transfer
|
||||
from braintree.unknown_payment_method import UnknownPaymentMethod as UnknownPaymentMethod
|
||||
from braintree.us_bank_account import UsBankAccount as UsBankAccount
|
||||
from braintree.us_bank_account_verification import UsBankAccountVerification as UsBankAccountVerification
|
||||
from braintree.validation_error_collection import ValidationErrorCollection as ValidationErrorCollection
|
||||
from braintree.venmo_account import VenmoAccount as VenmoAccount
|
||||
from braintree.venmo_profile_data import VenmoProfileData as VenmoProfileData
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import Final
|
||||
|
||||
from braintree.error_result import ErrorResult
|
||||
from braintree.successful_result import SuccessfulResult
|
||||
|
||||
class BankAccountInstantVerificationGateway:
|
||||
gateway: Incomplete
|
||||
config: Incomplete
|
||||
graphql_client: Incomplete
|
||||
CREATE_JWT_MUTATION: Final[str]
|
||||
def __init__(self, gateway) -> None: ...
|
||||
def create_jwt(self, request) -> SuccessfulResult | ErrorResult: ...
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from braintree.attribute_getter import AttributeGetter
|
||||
|
||||
class BankAccountInstantVerificationJwt(AttributeGetter):
|
||||
def __init__(self, jwt) -> None: ...
|
||||
@property
|
||||
def jwt(self): ...
|
||||
@jwt.setter
|
||||
def jwt(self, value) -> None: ...
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
from typing import TypedDict, type_check_only
|
||||
from typing_extensions import Self
|
||||
|
||||
@type_check_only
|
||||
class _ParamsDict(TypedDict, total=False):
|
||||
businessName: str
|
||||
returnUrl: str
|
||||
cancelUrl: str
|
||||
|
||||
class BankAccountInstantVerificationJwtRequest:
|
||||
def __init__(self) -> None: ...
|
||||
def business_name(self, business_name: str) -> Self: ...
|
||||
def return_url(self, return_url: str) -> Self: ...
|
||||
def cancel_url(self, cancel_url: str) -> Self: ...
|
||||
def get_business_name(self) -> str: ...
|
||||
def get_return_url(self) -> str: ...
|
||||
def get_cancel_url(self) -> str: ...
|
||||
def to_graphql_variables(self) -> _ParamsDict: ...
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
from _typeshed import Incomplete
|
||||
|
||||
from braintree.add_on_gateway import AddOnGateway
|
||||
from braintree.address_gateway import AddressGateway
|
||||
from braintree.apple_pay_gateway import ApplePayGateway
|
||||
from braintree.bank_account_instant_verification_gateway import BankAccountInstantVerificationGateway
|
||||
from braintree.client_token_gateway import ClientTokenGateway
|
||||
from braintree.configuration import Configuration
|
||||
from braintree.credit_card_gateway import CreditCardGateway
|
||||
|
|
@ -28,6 +27,7 @@ from braintree.transaction_gateway import TransactionGateway
|
|||
from braintree.transaction_line_item_gateway import TransactionLineItemGateway
|
||||
from braintree.us_bank_account_gateway import UsBankAccountGateway
|
||||
from braintree.us_bank_account_verification_gateway import UsBankAccountVerificationGateway
|
||||
from braintree.util.graphql_client import GraphQLClient
|
||||
from braintree.webhook_notification_gateway import WebhookNotificationGateway
|
||||
from braintree.webhook_testing_gateway import WebhookTestingGateway
|
||||
|
||||
|
|
@ -36,6 +36,7 @@ class BraintreeGateway:
|
|||
add_on: AddOnGateway
|
||||
address: AddressGateway
|
||||
apple_pay: ApplePayGateway
|
||||
bank_account_instant_verification: BankAccountInstantVerificationGateway
|
||||
client_token: ClientTokenGateway
|
||||
credit_card: CreditCardGateway
|
||||
customer: CustomerGateway
|
||||
|
|
@ -43,7 +44,7 @@ class BraintreeGateway:
|
|||
dispute: DisputeGateway
|
||||
document_upload: DocumentUploadGateway
|
||||
exchange_rate_quote: ExchangeRateQuoteGateway
|
||||
graphql_client: Incomplete
|
||||
graphql_client: GraphQLClient
|
||||
merchant: MerchantGateway
|
||||
merchant_account: MerchantAccountGateway
|
||||
oauth: OAuthGateway
|
||||
|
|
|
|||
|
|
@ -572,6 +572,8 @@ class ErrorCodes:
|
|||
TransactionIsNotEligibleForAdjustment: Final = "915219"
|
||||
TransactionMustBeInStateAuthorized: Final = "915218"
|
||||
TransactionSourceIsInvalid: Final = "915133"
|
||||
TransferTypeIsInvalid: Final = "97501"
|
||||
TransferDetailsAreRequired: Final = "97510"
|
||||
TypeIsInvalid: Final = "91523"
|
||||
TypeIsRequired: Final = "91524"
|
||||
UnsupportedVoiceAuthorization: Final = "91539"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
from typing import Any
|
||||
|
||||
from braintree.attribute_getter import AttributeGetter
|
||||
|
||||
class Receiver(AttributeGetter):
|
||||
def __init__(self, attributes: dict[str, Any] | None) -> None: ...
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
from typing import Any
|
||||
|
||||
from braintree.attribute_getter import AttributeGetter
|
||||
|
||||
class Sender(AttributeGetter):
|
||||
def __init__(self, attributes: dict[str, Any] | None) -> None: ...
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
from _typeshed import Incomplete
|
||||
from datetime import datetime
|
||||
from typing import TypedDict, type_check_only
|
||||
from typing_extensions import Self
|
||||
|
||||
@type_check_only
|
||||
class _ParamsDict(TypedDict, total=False):
|
||||
ach_mandate_text: str
|
||||
ach_mandate_accepted_at: str
|
||||
|
||||
class TransactionUsBankAccountRequest:
|
||||
parent: Incomplete
|
||||
def __init__(self, parent) -> None: ...
|
||||
def ach_mandate_text(self, ach_mandate_text: str) -> Self: ...
|
||||
def ach_mandate_accepted_at(self, ach_mandate_accepted_at: str | datetime) -> Self: ...
|
||||
def done(self): ...
|
||||
def to_param_dict(self) -> _ParamsDict: ...
|
||||
|
|
@ -1,4 +1,8 @@
|
|||
from braintree.attribute_getter import AttributeGetter
|
||||
from braintree.receiver import Receiver
|
||||
from braintree.sender import Sender
|
||||
|
||||
class Transfer(AttributeGetter):
|
||||
sender: Sender
|
||||
receiver: Receiver
|
||||
def __init__(self, attributes) -> None: ...
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class UsBankAccountVerification(AttributeGetter):
|
|||
class VerificationMethod:
|
||||
NetworkCheck: Final = "network_check"
|
||||
IndependentCheck: Final = "independent_check"
|
||||
InstantVerificationAccountValidation: Final = "instant_verification_account_validation"
|
||||
TokenizedCheck: Final = "tokenized_check"
|
||||
MicroTransfers: Final = "micro_transfers"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from _typeshed import IdentityFunction, Unused
|
|||
from collections.abc import Callable, Iterator, MutableMapping, Sequence
|
||||
from contextlib import AbstractContextManager
|
||||
from threading import Condition
|
||||
from typing import Any, TypeVar, overload
|
||||
from typing import Any, Generic, Literal, NamedTuple, TypeVar, overload
|
||||
from typing_extensions import Self, deprecated
|
||||
|
||||
__all__ = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod")
|
||||
|
|
@ -11,6 +11,7 @@ __version__: str
|
|||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
_T = TypeVar("_T")
|
||||
_R = TypeVar("_R")
|
||||
|
||||
class Cache(MutableMapping[_KT, _VT]):
|
||||
@overload
|
||||
|
|
@ -99,22 +100,52 @@ class TLRUCache(_TimedCache[_KT, _VT]):
|
|||
def ttu(self) -> Callable[[_KT, _VT, float], float]: ...
|
||||
def expire(self, time: float | None = None) -> list[tuple[_KT, _VT]]: ...
|
||||
|
||||
class _CacheInfo(NamedTuple):
|
||||
hits: int
|
||||
misses: int
|
||||
maxsize: int | None
|
||||
currsize: int
|
||||
|
||||
class _cached_wrapper(Generic[_R]):
|
||||
__wrapped__: Callable[..., _R]
|
||||
def __call__(self, /, *args: Any, **kwargs: Any) -> _R: ...
|
||||
|
||||
class _cached_wrapper_info(_cached_wrapper[_R]):
|
||||
def cache_info(self) -> _CacheInfo: ...
|
||||
def cache_clear(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def cached(
|
||||
cache: MutableMapping[_KT, Any] | None,
|
||||
key: Callable[..., _KT] = ...,
|
||||
lock: AbstractContextManager[Any] | None = None,
|
||||
condition: Condition | None = None,
|
||||
info: bool = False,
|
||||
) -> IdentityFunction: ...
|
||||
info: Literal[True] = ...,
|
||||
) -> Callable[[Callable[..., _R]], _cached_wrapper_info[_R]]: ...
|
||||
@overload
|
||||
def cached(
|
||||
cache: MutableMapping[_KT, Any] | None,
|
||||
key: Callable[..., _KT] = ...,
|
||||
lock: AbstractContextManager[Any] | None = None,
|
||||
condition: Condition | None = None,
|
||||
info: Literal[False] = ...,
|
||||
) -> Callable[[Callable[..., _R]], _cached_wrapper[_R]]: ...
|
||||
@overload
|
||||
@deprecated("Passing `info` as positional parameter is deprecated.")
|
||||
def cached(
|
||||
cache: MutableMapping[_KT, Any] | None,
|
||||
key: Callable[..., _KT] = ...,
|
||||
lock: AbstractContextManager[Any] | None = None,
|
||||
condition: bool | None = None,
|
||||
) -> IdentityFunction: ...
|
||||
condition: Literal[True] = ...,
|
||||
) -> Callable[[Callable[..., _R]], _cached_wrapper_info[_R]]: ...
|
||||
@overload
|
||||
@deprecated("Passing `info` as positional parameter is deprecated.")
|
||||
def cached(
|
||||
cache: MutableMapping[_KT, Any] | None,
|
||||
key: Callable[..., _KT] = ...,
|
||||
lock: AbstractContextManager[Any] | None = None,
|
||||
condition: Literal[False] | None = ...,
|
||||
) -> Callable[[Callable[..., _R]], _cached_wrapper[_R]]: ...
|
||||
def cachedmethod(
|
||||
cache: Callable[[Any], MutableMapping[_KT, Any] | None],
|
||||
key: Callable[..., _KT] = ...,
|
||||
|
|
|
|||
|
|
@ -1,16 +1,51 @@
|
|||
from _typeshed import IdentityFunction
|
||||
from collections.abc import Callable, Sequence
|
||||
from typing import TypeVar
|
||||
from typing import Any, Final, Generic, NamedTuple, TypeVar, overload
|
||||
|
||||
__all__: Final = ("fifo_cache", "lfu_cache", "lru_cache", "rr_cache", "ttl_cache")
|
||||
|
||||
__all__ = ("fifo_cache", "lfu_cache", "lru_cache", "rr_cache", "ttl_cache")
|
||||
_T = TypeVar("_T")
|
||||
_R = TypeVar("_R")
|
||||
|
||||
def fifo_cache(maxsize: float | None = 128, typed: bool = False) -> IdentityFunction: ...
|
||||
def lfu_cache(maxsize: float | None = 128, typed: bool = False) -> IdentityFunction: ...
|
||||
def lru_cache(maxsize: float | None = 128, typed: bool = False) -> IdentityFunction: ...
|
||||
class _CacheInfo(NamedTuple):
|
||||
hits: int
|
||||
misses: int
|
||||
maxsize: int | None
|
||||
currsize: int
|
||||
|
||||
class _cachetools_cache_wrapper(Generic[_R]):
|
||||
__wrapped__: Callable[..., _R]
|
||||
def __call__(self, /, *args: Any, **kwargs: Any) -> _R: ...
|
||||
def cache_info(self) -> _CacheInfo: ...
|
||||
def cache_clear(self) -> None: ...
|
||||
def cache_parameters(self) -> dict[str, Any]: ...
|
||||
|
||||
@overload
|
||||
def fifo_cache(
|
||||
maxsize: int | None = 128, typed: bool = False
|
||||
) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
|
||||
@overload
|
||||
def fifo_cache(maxsize: Callable[..., _R], typed: bool = False) -> _cachetools_cache_wrapper[_R]: ...
|
||||
@overload
|
||||
def lfu_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
|
||||
@overload
|
||||
def lfu_cache(maxsize: Callable[..., _R], typed: bool = False) -> _cachetools_cache_wrapper[_R]: ...
|
||||
@overload
|
||||
def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
|
||||
@overload
|
||||
def lru_cache(maxsize: Callable[..., _R], typed: bool = False) -> _cachetools_cache_wrapper[_R]: ...
|
||||
@overload
|
||||
def rr_cache(
|
||||
maxsize: float | None = 128, choice: Callable[[Sequence[_T]], _T] | None = ..., typed: bool = False
|
||||
) -> IdentityFunction: ...
|
||||
maxsize: int | None = 128, choice: Callable[[Sequence[_T]], _T] | None = ..., typed: bool = False
|
||||
) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
|
||||
@overload
|
||||
def rr_cache(
|
||||
maxsize: Callable[..., _R], choice: Callable[[Sequence[_T]], _T] | None = ..., typed: bool = False
|
||||
) -> _cachetools_cache_wrapper[_R]: ...
|
||||
@overload
|
||||
def ttl_cache(
|
||||
maxsize: float | None = 128, ttl: float = 600, timer: Callable[[], float] = ..., typed: bool = False
|
||||
) -> IdentityFunction: ...
|
||||
maxsize: int | None = 128, ttl: float = 600, timer: Callable[[], float] = ..., typed: bool = False
|
||||
) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
|
||||
@overload
|
||||
def ttl_cache(
|
||||
maxsize: Callable[..., _R], ttl: float = 600, timer: Callable[[], float] = ..., typed: bool = False
|
||||
) -> _cachetools_cache_wrapper[_R]: ...
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ from collections.abc import Hashable
|
|||
__all__ = ("hashkey", "methodkey", "typedkey", "typedmethodkey")
|
||||
|
||||
def hashkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
|
||||
def methodkey(self: Unused, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
|
||||
def methodkey(self: Unused, /, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
|
||||
def typedkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
|
||||
def typedmethodkey(self: Unused, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
|
||||
def typedmethodkey(self: Unused, /, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version = "25.1.*"
|
||||
version = "25.2.*"
|
||||
upstream_repository = "https://github.com/carltongibson/django-filter/"
|
||||
requires = ["django-stubs"]
|
||||
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ class OrderingFilter(BaseCSVFilter, ChoiceFilter):
|
|||
field_name: str | None = None,
|
||||
lookup_expr: str | None = None,
|
||||
*,
|
||||
fields: dict[str, str] | Iterable[tuple[str, str]] = ...,
|
||||
fields: dict[str, str] | Iterable[str] | Iterable[tuple[str, str]] = ...,
|
||||
field_labels: dict[str, StrOrPromise] = ...,
|
||||
# Inherited from ChoiceFilter
|
||||
null_value: Any = ..., # Null value can be any type (None, empty string, etc.)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version = "7.1.*"
|
||||
upstream_repository = "https://github.com/docker/docker-py"
|
||||
requires = ["types-requests", "urllib3>=2"]
|
||||
requires = ["types-paramiko", "types-requests", "urllib3>=2"]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from _typeshed import Incomplete
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
log: Incomplete
|
||||
log: logging.Logger
|
||||
|
||||
class ImageApiMixin:
|
||||
def get_image(self, image: str, chunk_size: int | None = 2097152): ...
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
from _typeshed import Incomplete
|
||||
import logging
|
||||
from typing import Literal
|
||||
|
||||
log: Incomplete
|
||||
from docker.types.swarm import SwarmSpec
|
||||
|
||||
log: logging.Logger
|
||||
|
||||
class SwarmApiMixin:
|
||||
def create_swarm_spec(self, *args, **kwargs): ...
|
||||
def create_swarm_spec(self, *args, **kwargs) -> SwarmSpec: ...
|
||||
def get_unlock_key(self): ...
|
||||
def init_swarm(
|
||||
self,
|
||||
|
|
@ -20,12 +23,12 @@ class SwarmApiMixin:
|
|||
def inspect_node(self, node_id): ...
|
||||
def join_swarm(
|
||||
self, remote_addrs, join_token, listen_addr: str = "0.0.0.0:2377", advertise_addr=None, data_path_addr=None
|
||||
): ...
|
||||
def leave_swarm(self, force: bool = False): ...
|
||||
) -> Literal[True]: ...
|
||||
def leave_swarm(self, force: bool = False) -> Literal[True]: ...
|
||||
def nodes(self, filters=None): ...
|
||||
def remove_node(self, node_id, force: bool = False): ...
|
||||
def unlock_swarm(self, key): ...
|
||||
def update_node(self, node_id, version, node_spec=None): ...
|
||||
def remove_node(self, node_id, force: bool = False) -> Literal[True]: ...
|
||||
def unlock_swarm(self, key) -> Literal[True]: ...
|
||||
def update_node(self, node_id, version, node_spec=None) -> Literal[True]: ...
|
||||
def update_swarm(
|
||||
self,
|
||||
version,
|
||||
|
|
@ -33,4 +36,4 @@ class SwarmApiMixin:
|
|||
rotate_worker_token: bool = False,
|
||||
rotate_manager_token: bool = False,
|
||||
rotate_manager_unlock_key: bool = False,
|
||||
): ...
|
||||
) -> Literal[True]: ...
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
from _typeshed import Incomplete
|
||||
|
||||
class Store:
|
||||
program: Incomplete
|
||||
exe: Incomplete
|
||||
program: str
|
||||
exe: str | None
|
||||
environment: Incomplete
|
||||
def __init__(self, program, environment=None) -> None: ...
|
||||
def __init__(self, program: str, environment=None) -> None: ...
|
||||
def get(self, server): ...
|
||||
def store(self, server, username, secret): ...
|
||||
def erase(self, server) -> None: ...
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
from _typeshed import Incomplete
|
||||
from collections.abc import Iterator, Mapping
|
||||
from typing import NoReturn
|
||||
from typing import Any, NoReturn
|
||||
|
||||
from docker.models.containers import Container
|
||||
from docker.models.images import Image
|
||||
from requests import HTTPError, Response
|
||||
|
||||
class DockerException(Exception): ...
|
||||
|
|
@ -35,11 +35,13 @@ class NullResource(DockerException, ValueError): ...
|
|||
|
||||
class ContainerError(DockerException):
|
||||
container: Container
|
||||
exit_status: Incomplete
|
||||
command: Incomplete
|
||||
image: Incomplete
|
||||
exit_status: int
|
||||
command: str | list[str] | None
|
||||
image: str | Image
|
||||
stderr: str | None
|
||||
def __init__(self, container: Container, exit_status, command, image, stderr: str | None) -> None: ...
|
||||
def __init__(
|
||||
self, container: Container, exit_status: int, command: str | list[str] | None, image: str | Image, stderr: str | None
|
||||
) -> None: ...
|
||||
|
||||
class StreamParseError(RuntimeError):
|
||||
msg: str
|
||||
|
|
@ -52,7 +54,7 @@ class BuildError(DockerException):
|
|||
|
||||
class ImageLoadError(DockerException): ...
|
||||
|
||||
def create_unexpected_kwargs_error(name, kwargs: Mapping[str, Incomplete]) -> NoReturn: ...
|
||||
def create_unexpected_kwargs_error(name, kwargs: Mapping[str, Any]) -> NoReturn: ...
|
||||
|
||||
class MissingContextParameter(DockerException):
|
||||
param: str
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from _typeshed import Incomplete
|
||||
|
||||
from .resource import Collection, Model
|
||||
|
||||
class Service(Model):
|
||||
|
|
@ -21,7 +19,7 @@ class ServiceCollection(Collection[Service]):
|
|||
def get(self, service_id, insert_defaults=None): ...
|
||||
def list(self, **kwargs): ...
|
||||
|
||||
CONTAINER_SPEC_KWARGS: Incomplete
|
||||
TASK_TEMPLATE_KWARGS: Incomplete
|
||||
CREATE_SERVICE_KWARGS: Incomplete
|
||||
PLACEMENT_KWARGS: Incomplete
|
||||
CONTAINER_SPEC_KWARGS: list[str]
|
||||
TASK_TEMPLATE_KWARGS: list[str]
|
||||
CREATE_SERVICE_KWARGS: list[str]
|
||||
PLACEMENT_KWARGS: list[str]
|
||||
|
|
|
|||
|
|
@ -1,29 +1,29 @@
|
|||
from _typeshed import Incomplete
|
||||
|
||||
import urllib3
|
||||
import urllib3.connection
|
||||
from docker.transport.basehttpadapter import BaseHTTPAdapter
|
||||
from docker.transport.npipesocket import NpipeSocket
|
||||
from urllib3._collections import RecentlyUsedContainer as urllib3_RecentlyUsedContainer
|
||||
|
||||
RecentlyUsedContainer: Incomplete
|
||||
RecentlyUsedContainer = urllib3_RecentlyUsedContainer
|
||||
|
||||
class NpipeHTTPConnection(urllib3.connection.HTTPConnection):
|
||||
npipe_path: Incomplete
|
||||
timeout: Incomplete
|
||||
def __init__(self, npipe_path, timeout: int = 60) -> None: ...
|
||||
sock: Incomplete
|
||||
npipe_path: str
|
||||
timeout: int
|
||||
def __init__(self, npipe_path: str, timeout: int = 60) -> None: ...
|
||||
sock: NpipeSocket | None
|
||||
def connect(self) -> None: ...
|
||||
|
||||
class NpipeHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
|
||||
npipe_path: Incomplete
|
||||
timeout: Incomplete
|
||||
def __init__(self, npipe_path, timeout: int = 60, maxsize: int = 10) -> None: ...
|
||||
npipe_path: str
|
||||
timeout: urllib3.Timeout
|
||||
def __init__(self, npipe_path: str, timeout: int = 60, maxsize: int = 10) -> None: ...
|
||||
|
||||
class NpipeHTTPAdapter(BaseHTTPAdapter):
|
||||
__attrs__: Incomplete
|
||||
npipe_path: Incomplete
|
||||
timeout: Incomplete
|
||||
max_pool_size: Incomplete
|
||||
pools: Incomplete
|
||||
def __init__(self, base_url, timeout: int = 60, pool_connections=..., max_pool_size=...) -> None: ...
|
||||
__attrs__: list[str]
|
||||
npipe_path: str
|
||||
timeout: int
|
||||
max_pool_size: int
|
||||
pools: RecentlyUsedContainer
|
||||
def __init__(self, base_url: str, timeout: int = 60, pool_connections: int = 25, max_pool_size: int = 10) -> None: ...
|
||||
def get_connection(self, url, proxies=None): ...
|
||||
def request_url(self, request, proxies): ...
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import io
|
||||
from _typeshed import Incomplete
|
||||
from _typeshed import ReadableBuffer
|
||||
from typing import Any, Literal, NoReturn
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
cERROR_PIPE_BUSY: int
|
||||
cSECURITY_SQOS_PRESENT: int
|
||||
|
|
@ -8,42 +10,48 @@ MAXIMUM_RETRY_COUNT: int
|
|||
|
||||
def check_closed(f): ...
|
||||
|
||||
_PyHANDLE: TypeAlias = Any # pywin32._win32typing.PyHANDLE
|
||||
|
||||
class NpipeSocket:
|
||||
def __init__(self, handle=None) -> None: ...
|
||||
def __init__(self, handle: _PyHANDLE | None = None) -> None: ...
|
||||
def accept(self) -> None: ...
|
||||
def bind(self, address) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
flags: Incomplete
|
||||
def connect(self, address, retry_count: int = 0): ...
|
||||
def connect_ex(self, address): ...
|
||||
def detach(self): ...
|
||||
def dup(self): ...
|
||||
def getpeername(self): ...
|
||||
def getsockname(self): ...
|
||||
def getsockopt(self, level, optname, buflen=None) -> None: ...
|
||||
def ioctl(self, control, option) -> None: ...
|
||||
def listen(self, backlog) -> None: ...
|
||||
def makefile(self, mode=None, bufsize=None): ...
|
||||
def recv(self, bufsize, flags: int = 0): ...
|
||||
def recvfrom(self, bufsize, flags: int = 0): ...
|
||||
def recvfrom_into(self, buf, nbytes: int = 0, flags: int = 0): ...
|
||||
def recv_into(self, buf, nbytes: int = 0): ...
|
||||
def send(self, string, flags: int = 0): ...
|
||||
def sendall(self, string, flags: int = 0): ...
|
||||
def sendto(self, string, address): ...
|
||||
def setblocking(self, flag): ...
|
||||
def settimeout(self, value) -> None: ...
|
||||
def gettimeout(self): ...
|
||||
def setsockopt(self, level, optname, value) -> None: ...
|
||||
def shutdown(self, how): ...
|
||||
flags: int
|
||||
def connect(self, address: str, retry_count: int = 0) -> None: ...
|
||||
def connect_ex(self, address: str) -> None: ...
|
||||
def detach(self) -> _PyHANDLE | None: ...
|
||||
def dup(self) -> NpipeSocket: ...
|
||||
def getpeername(self) -> str: ...
|
||||
def getsockname(self) -> str: ...
|
||||
# NotImplementedError
|
||||
def getsockopt(self, level, optname, buflen=None) -> NoReturn: ...
|
||||
# NotImplementedError
|
||||
def ioctl(self, control, option) -> NoReturn: ...
|
||||
# NotImplementedError
|
||||
def listen(self, backlog) -> NoReturn: ...
|
||||
def makefile(self, mode: str | None = None, bufsize: int | None = None) -> io.BufferedReader: ...
|
||||
def recv(self, bufsize: int, flags: int = 0) -> str: ...
|
||||
def recvfrom(self, bufsize: int, flags: int = 0) -> tuple[str, str]: ...
|
||||
def recvfrom_into(self, buf: memoryview | ReadableBuffer, nbytes: int = 0, flags: int = 0) -> tuple[int, str]: ...
|
||||
def recv_into(self, buf: memoryview | ReadableBuffer, nbytes: int = 0) -> int: ...
|
||||
def send(self, string: str, flags: int = 0) -> int: ...
|
||||
def sendall(self, string: str, flags: int = 0) -> int: ...
|
||||
def sendto(self, string: str, address: str) -> int: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
def settimeout(self, value: float | None) -> None: ...
|
||||
def gettimeout(self) -> int | None: ...
|
||||
# NotImplementedError
|
||||
def setsockopt(self, level, optname, value) -> NoReturn: ...
|
||||
def shutdown(self, how) -> None: ...
|
||||
|
||||
class NpipeFileIOBase(io.RawIOBase):
|
||||
sock: Incomplete
|
||||
def __init__(self, npipe_socket) -> None: ...
|
||||
sock: NpipeSocket
|
||||
def __init__(self, npipe_socket: NpipeSocket) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def fileno(self): ...
|
||||
def isatty(self): ...
|
||||
def readable(self): ...
|
||||
def readinto(self, buf): ...
|
||||
def seekable(self): ...
|
||||
def writable(self): ...
|
||||
def isatty(self) -> Literal[False]: ...
|
||||
def readable(self) -> Literal[True]: ...
|
||||
def readinto(self, buf: memoryview | ReadableBuffer) -> int: ...
|
||||
def seekable(self) -> Literal[False]: ...
|
||||
def writable(self) -> Literal[False]: ...
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
import socket
|
||||
from _typeshed import Incomplete
|
||||
import subprocess
|
||||
|
||||
import urllib3
|
||||
import urllib3.connection
|
||||
from docker.transport.basehttpadapter import BaseHTTPAdapter
|
||||
from paramiko import SSHClient, Transport
|
||||
from urllib3._collections import RecentlyUsedContainer as urllib3_RecentlyUsedContainer
|
||||
|
||||
RecentlyUsedContainer: Incomplete
|
||||
RecentlyUsedContainer = urllib3_RecentlyUsedContainer
|
||||
|
||||
class SSHSocket(socket.socket):
|
||||
host: Incomplete
|
||||
port: Incomplete
|
||||
user: Incomplete
|
||||
proc: Incomplete
|
||||
def __init__(self, host) -> None: ...
|
||||
host: str
|
||||
port: str | None
|
||||
user: str | None
|
||||
proc: subprocess.Popen[bytes] | None
|
||||
def __init__(self, host: str) -> None: ...
|
||||
def connect(self, **kwargs) -> None: ... # type:ignore[override]
|
||||
def sendall(self, data) -> None: ... # type:ignore[override]
|
||||
def send(self, data): ... # type:ignore[override]
|
||||
|
|
@ -21,27 +23,31 @@ class SSHSocket(socket.socket):
|
|||
def close(self) -> None: ...
|
||||
|
||||
class SSHConnection(urllib3.connection.HTTPConnection):
|
||||
ssh_transport: Incomplete
|
||||
timeout: Incomplete
|
||||
ssh_host: Incomplete
|
||||
def __init__(self, ssh_transport=None, timeout: int = 60, host=None) -> None: ...
|
||||
sock: Incomplete
|
||||
ssh_transport: Transport | None
|
||||
timeout: int
|
||||
ssh_host: str | None
|
||||
def __init__(self, ssh_transport: Transport | None = None, timeout: int = 60, host: str | None = None) -> None: ...
|
||||
sock: SSHSocket | None
|
||||
def connect(self) -> None: ...
|
||||
|
||||
class SSHConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
|
||||
scheme: str
|
||||
ssh_transport: Incomplete
|
||||
timeout: Incomplete
|
||||
ssh_host: Incomplete
|
||||
def __init__(self, ssh_client=None, timeout: int = 60, maxsize: int = 10, host=None) -> None: ...
|
||||
ssh_transport: Transport | None
|
||||
timeout: urllib3.Timeout
|
||||
ssh_host: str | None
|
||||
def __init__(
|
||||
self, ssh_client: SSHClient | None = None, timeout: int = 60, maxsize: int = 10, host: str | None = None
|
||||
) -> None: ...
|
||||
|
||||
class SSHHTTPAdapter(BaseHTTPAdapter):
|
||||
__attrs__: Incomplete
|
||||
ssh_client: Incomplete
|
||||
ssh_host: Incomplete
|
||||
timeout: Incomplete
|
||||
max_pool_size: Incomplete
|
||||
pools: Incomplete
|
||||
def __init__(self, base_url, timeout: int = 60, pool_connections=25, max_pool_size=10, shell_out: bool = False) -> None: ...
|
||||
def get_connection(self, url, proxies=None): ...
|
||||
__attrs__: list[str]
|
||||
ssh_client: SSHClient | None
|
||||
ssh_host: str
|
||||
timeout: int
|
||||
max_pool_size: int
|
||||
pools: int
|
||||
def __init__(
|
||||
self, base_url: str, timeout: int = 60, pool_connections: int = 25, max_pool_size: int = 10, shell_out: bool = False
|
||||
) -> None: ...
|
||||
def get_connection(self, url: str | bytes, proxies=None) -> SSHConnectionPool: ...
|
||||
def close(self) -> None: ...
|
||||
|
|
|
|||
|
|
@ -1,31 +1,34 @@
|
|||
from _typeshed import Incomplete
|
||||
import socket
|
||||
|
||||
import urllib3
|
||||
import urllib3.connection
|
||||
from docker.transport.basehttpadapter import BaseHTTPAdapter
|
||||
from requests import PreparedRequest
|
||||
from urllib3._collections import RecentlyUsedContainer as urllib3_RecentlyUsedContainer
|
||||
|
||||
RecentlyUsedContainer: Incomplete
|
||||
RecentlyUsedContainer = urllib3_RecentlyUsedContainer
|
||||
|
||||
class UnixHTTPConnection(urllib3.connection.HTTPConnection):
|
||||
base_url: Incomplete
|
||||
unix_socket: Incomplete
|
||||
timeout: Incomplete
|
||||
def __init__(self, base_url, unix_socket, timeout: int = 60) -> None: ...
|
||||
sock: Incomplete
|
||||
base_url: str
|
||||
unix_socket: str
|
||||
timeout: int
|
||||
def __init__(self, base_url: str, unix_socket: str, timeout: int = 60) -> None: ...
|
||||
sock: socket.socket | None
|
||||
def connect(self) -> None: ...
|
||||
|
||||
class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
|
||||
base_url: Incomplete
|
||||
socket_path: Incomplete
|
||||
timeout: Incomplete
|
||||
def __init__(self, base_url, socket_path, timeout: int = 60, maxsize: int = 10) -> None: ...
|
||||
base_url: str
|
||||
socket_path: str
|
||||
timeout: urllib3.Timeout
|
||||
def __init__(self, base_url: str, socket_path: str, timeout: int = 60, maxsize: int = 10) -> None: ...
|
||||
|
||||
class UnixHTTPAdapter(BaseHTTPAdapter):
|
||||
__attrs__: Incomplete
|
||||
socket_path: Incomplete
|
||||
timeout: Incomplete
|
||||
max_pool_size: Incomplete
|
||||
pools: Incomplete
|
||||
def __init__(self, socket_url, timeout: int = 60, pool_connections=25, max_pool_size=10) -> None: ...
|
||||
def get_connection(self, url, proxies=None): ...
|
||||
def request_url(self, request, proxies): ...
|
||||
__attrs__: list[str]
|
||||
socket_path: str
|
||||
timeout: int
|
||||
max_pool_size: int
|
||||
pools: RecentlyUsedContainer
|
||||
def __init__(self, socket_url: str, timeout: int = 60, pool_connections: int = 25, max_pool_size: int = 10) -> None: ...
|
||||
def get_connection(self, url: bytes | str, proxies=None) -> UnixHTTPConnectionPool: ...
|
||||
# proxies is unused
|
||||
def request_url(self, request: PreparedRequest, proxies) -> str: ...
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class EndpointConfig(dict[str, Incomplete]):
|
|||
def __init__(
|
||||
self,
|
||||
version: str,
|
||||
aliases: list[Incomplete] | None = None,
|
||||
aliases: list[str] | None = None,
|
||||
links: dict[str, str] | dict[str, None] | dict[str, str | None] | Iterable[tuple[str, str | None]] | None = None,
|
||||
ipv4_address: str | None = None,
|
||||
ipv6_address: str | None = None,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from _typeshed import Incomplete
|
||||
from collections.abc import Iterable, Mapping
|
||||
from typing import Final, Literal, TypeVar, overload
|
||||
from typing import Final, Literal, TypedDict, TypeVar, overload
|
||||
|
||||
from .healthcheck import Healthcheck
|
||||
|
||||
|
|
@ -36,12 +36,12 @@ class ContainerSpec(dict[str, Incomplete]):
|
|||
env: dict[str, Incomplete] | list[str] | None = None,
|
||||
workdir: str | None = None,
|
||||
user: str | None = None,
|
||||
labels: dict[Incomplete, Incomplete] | None = None,
|
||||
labels: dict[str, str] | None = None,
|
||||
mounts: Iterable[str | Mount] | None = None,
|
||||
stop_grace_period: int | None = None,
|
||||
secrets: list[SecretReference] | None = None,
|
||||
tty: bool | None = None,
|
||||
groups: list[Incomplete] | None = None,
|
||||
groups: list[str] | None = None,
|
||||
open_stdin: bool | None = None,
|
||||
read_only: bool | None = None,
|
||||
stop_signal: str | None = None,
|
||||
|
|
@ -52,9 +52,9 @@ class ContainerSpec(dict[str, Incomplete]):
|
|||
privileges: Privileges | None = None,
|
||||
isolation: str | None = None,
|
||||
init: bool | None = None,
|
||||
cap_add: list[Incomplete] | None = None,
|
||||
cap_drop: list[Incomplete] | None = None,
|
||||
sysctls: dict[str, Incomplete] | None = None,
|
||||
cap_add: list[str] | None = None,
|
||||
cap_drop: list[str] | None = None,
|
||||
sysctls: dict[str, str] | None = None,
|
||||
) -> None: ...
|
||||
|
||||
class Mount(dict[str, Incomplete]):
|
||||
|
|
@ -67,7 +67,7 @@ class Mount(dict[str, Incomplete]):
|
|||
consistency: Literal["default", "consistent", "cached", "delegated"] | None = None,
|
||||
propagation: str | None = None,
|
||||
no_copy: bool = False,
|
||||
labels: dict[Incomplete, Incomplete] | None = None,
|
||||
labels: dict[str, str] | None = None,
|
||||
driver_config: DriverConfig | None = None,
|
||||
tmpfs_size: int | str | None = None,
|
||||
tmpfs_mode: int | None = None,
|
||||
|
|
@ -75,6 +75,10 @@ class Mount(dict[str, Incomplete]):
|
|||
@classmethod
|
||||
def parse_mount_string(cls, string: str) -> Mount: ...
|
||||
|
||||
class _ResourceDict(TypedDict):
|
||||
Kind: str
|
||||
Value: int
|
||||
|
||||
class Resources(dict[str, Incomplete]):
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -82,7 +86,9 @@ class Resources(dict[str, Incomplete]):
|
|||
mem_limit: int | None = None,
|
||||
cpu_reservation: int | None = None,
|
||||
mem_reservation: int | None = None,
|
||||
generic_resources: dict[str, Incomplete] | list[str] | None = None,
|
||||
generic_resources: (
|
||||
dict[str, int | str] | list[dict[Literal["DiscreteResourceSpec", "NamedResourceSpec"], _ResourceDict]] | None
|
||||
) = None,
|
||||
) -> None: ...
|
||||
|
||||
class UpdateConfig(dict[str, Incomplete]):
|
||||
|
|
@ -110,7 +116,7 @@ class RestartPolicy(dict[str, Incomplete]):
|
|||
) -> None: ...
|
||||
|
||||
class DriverConfig(dict[str, Incomplete]):
|
||||
def __init__(self, name: str, options: dict[Incomplete, Incomplete] | None = None) -> None: ...
|
||||
def __init__(self, name: str, options: dict[str, str] | None = None) -> None: ...
|
||||
|
||||
class EndpointSpec(dict[str, Incomplete]):
|
||||
def __init__(
|
||||
|
|
@ -185,4 +191,4 @@ class Privileges(dict[str, Incomplete]):
|
|||
) -> None: ...
|
||||
|
||||
class NetworkAttachmentConfig(dict[str, Incomplete]):
|
||||
def __init__(self, target: str, aliases: list[str] | None = None, options: dict[str, Incomplete] | None = None) -> None: ...
|
||||
def __init__(self, target: str, aliases: list[str] | None = None, options: dict[str, str] | None = None) -> None: ...
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import Any
|
||||
|
||||
from .services import DriverConfig
|
||||
|
|
@ -17,7 +16,7 @@ class SwarmSpec(dict[str, Any]):
|
|||
node_cert_expiry: int | None = None,
|
||||
external_cas: list[SwarmExternalCA] | None = None,
|
||||
name: str | None = None,
|
||||
labels: dict[str, Incomplete] | None = None,
|
||||
labels: dict[str, str] | None = None,
|
||||
signing_ca_cert: str | None = None,
|
||||
signing_ca_key: str | None = None,
|
||||
ca_force_rotate: int | None = None,
|
||||
|
|
@ -27,9 +26,5 @@ class SwarmSpec(dict[str, Any]):
|
|||
|
||||
class SwarmExternalCA(dict[str, Any]):
|
||||
def __init__(
|
||||
self,
|
||||
url: str,
|
||||
protocol: str | None = None,
|
||||
options: dict[Incomplete, Incomplete] | None = None,
|
||||
ca_cert: str | None = None,
|
||||
self, url: str, protocol: str | None = None, options: dict[str, str] | None = None, ca_cert: str | None = None
|
||||
) -> None: ...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from typing import TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
def check_resource(resource_name: str): ...
|
||||
def minimum_version(version: str): ...
|
||||
def update_headers(f: Callable[..., Incomplete]): ...
|
||||
_P = ParamSpec("_P")
|
||||
_R = TypeVar("_R")
|
||||
|
||||
def check_resource(resource_name: str) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
|
||||
def minimum_version(version: str) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
|
||||
def update_headers(f: Callable[_P, _R]) -> Callable[_P, _R]: ...
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import datetime
|
||||
from _typeshed import FileDescriptorOrPath, Incomplete, ReadableBuffer
|
||||
from _typeshed import FileDescriptorOrPath, ReadableBuffer
|
||||
from collections.abc import Iterable, Mapping
|
||||
from shlex import _ShlexInstream
|
||||
from typing import Literal, NamedTuple, NoReturn, TypedDict, TypeVar, overload, type_check_only
|
||||
|
|
@ -38,7 +38,7 @@ def convert_port_bindings(
|
|||
@overload
|
||||
def convert_volume_binds(binds: list[_T]) -> list[_T]: ...
|
||||
@overload
|
||||
def convert_volume_binds(binds: Mapping[str | bytes, Incomplete]) -> list[str]: ...
|
||||
def convert_volume_binds(binds: Mapping[str | bytes, bytes | str | dict[str, bytes | str]]) -> list[str]: ...
|
||||
@overload
|
||||
def convert_tmpfs_mounts(tmpfs: dict[_K, _V]) -> dict[_K, _V]: ...
|
||||
@overload
|
||||
|
|
@ -56,8 +56,8 @@ def parse_host(
|
|||
) -> Literal["http+unix:///var/run/docker.sock"]: ...
|
||||
@overload
|
||||
def parse_host(addr: str | None, is_win32: bool = False, tls: bool = False) -> str | bytes: ...
|
||||
def parse_devices(devices: Iterable[str | dict[str, Incomplete]]) -> list[dict[str, Incomplete]]: ...
|
||||
def kwargs_from_env(environment: Mapping[str, Incomplete] | None = None) -> _EnvKWArgs: ...
|
||||
def parse_devices(devices: Iterable[str | dict[str, str]]) -> list[dict[str, str]]: ...
|
||||
def kwargs_from_env(environment: Mapping[str, str] | None = None) -> _EnvKWArgs: ...
|
||||
def convert_filters(filters) -> str: ...
|
||||
def datetime_to_timestamp(dt: datetime.datetime) -> int: ...
|
||||
def parse_bytes(s: float | str) -> float: ...
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class Node:
|
|||
@overload
|
||||
def next_node(
|
||||
self, condition: type[_N], include_self: bool = False, descend: bool = True, siblings: bool = False, ascend: bool = False
|
||||
) -> _N: ...
|
||||
) -> _N | None: ...
|
||||
@overload
|
||||
def next_node(
|
||||
self,
|
||||
|
|
@ -98,7 +98,7 @@ class Node:
|
|||
descend: bool = True,
|
||||
siblings: bool = False,
|
||||
ascend: bool = False,
|
||||
) -> Node: ...
|
||||
) -> Node | None: ...
|
||||
def validate(self, recursive: bool = True) -> None: ...
|
||||
def validate_position(self) -> None: ...
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
version = "0.3.*"
|
||||
version = "0.4.*"
|
||||
upstream_repository = "https://github.com/peterjc/flake8-rst-docstrings"
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
version = "1.16.*"
|
||||
version = "1.17.*"
|
||||
upstream_repository = "https://github.com/asottile/flake8-typing-imports"
|
||||
|
|
|
|||
|
|
@ -76,13 +76,10 @@ def secure_channel(
|
|||
) -> Channel: ...
|
||||
|
||||
_Interceptor: TypeAlias = (
|
||||
UnaryUnaryClientInterceptor[_TRequest, _TResponse]
|
||||
| UnaryStreamClientInterceptor[_TRequest, _TResponse]
|
||||
| StreamUnaryClientInterceptor[_TRequest, _TResponse]
|
||||
| StreamStreamClientInterceptor[_TRequest, _TResponse]
|
||||
UnaryUnaryClientInterceptor | UnaryStreamClientInterceptor | StreamUnaryClientInterceptor | StreamStreamClientInterceptor
|
||||
)
|
||||
|
||||
def intercept_channel(channel: Channel, *interceptors: _Interceptor[_TRequest, _TResponse]) -> Channel: ...
|
||||
def intercept_channel(channel: Channel, *interceptors: _Interceptor) -> Channel: ...
|
||||
|
||||
# Create Client Credentials:
|
||||
|
||||
|
|
@ -108,8 +105,8 @@ def composite_channel_credentials(
|
|||
|
||||
def server(
|
||||
thread_pool: futures.ThreadPoolExecutor,
|
||||
handlers: list[GenericRpcHandler[Any, Any]] | None = None,
|
||||
interceptors: list[ServerInterceptor[Any, Any]] | None = None,
|
||||
handlers: list[GenericRpcHandler] | None = None,
|
||||
interceptors: list[ServerInterceptor] | None = None,
|
||||
options: _Options | None = None,
|
||||
maximum_concurrent_rpcs: int | None = None,
|
||||
compression: Compression | None = None,
|
||||
|
|
@ -173,7 +170,7 @@ def stream_stream_rpc_method_handler(
|
|||
) -> RpcMethodHandler[_TRequest, _TResponse]: ...
|
||||
def method_handlers_generic_handler(
|
||||
service: str, method_handlers: dict[str, RpcMethodHandler[Any, Any]]
|
||||
) -> GenericRpcHandler[Any, Any]: ...
|
||||
) -> GenericRpcHandler: ...
|
||||
|
||||
# Channel Ready Future:
|
||||
|
||||
|
|
@ -264,7 +261,7 @@ class Channel(abc.ABC):
|
|||
|
||||
class Server(abc.ABC):
|
||||
@abc.abstractmethod
|
||||
def add_generic_rpc_handlers(self, generic_rpc_handlers: Iterable[GenericRpcHandler[Any, Any]]) -> None: ...
|
||||
def add_generic_rpc_handlers(self, generic_rpc_handlers: Iterable[GenericRpcHandler]) -> None: ...
|
||||
|
||||
# Returns an integer port on which server will accept RPC requests.
|
||||
@abc.abstractmethod
|
||||
|
|
@ -378,25 +375,13 @@ class ClientCallDetails(abc.ABC):
|
|||
@type_check_only
|
||||
class _CallFuture(Call, Future[_TResponse], metaclass=abc.ABCMeta): ...
|
||||
|
||||
class UnaryUnaryClientInterceptor(abc.ABC, Generic[_TRequest, _TResponse]):
|
||||
class UnaryUnaryClientInterceptor(abc.ABC):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return continuation(client_call_details, request)`.
|
||||
@abc.abstractmethod
|
||||
def intercept_unary_unary(
|
||||
self,
|
||||
# FIXME: decode these cryptic runes to confirm the typing mystery of
|
||||
# this callable's signature that was left for us by past civilisations:
|
||||
#
|
||||
# continuation - A function that proceeds with the invocation by
|
||||
# executing the next interceptor in chain or invoking the actual RPC
|
||||
# on the underlying Channel. It is the interceptor's responsibility
|
||||
# to call it if it decides to move the RPC forward. The interceptor
|
||||
# can use response_future = continuation(client_call_details,
|
||||
# request) to continue with the RPC. continuation returns an object
|
||||
# that is both a Call for the RPC and a Future. In the event of RPC
|
||||
# completion, the return Call-Future's result value will be the
|
||||
# response message of the RPC. Should the event terminate with non-OK
|
||||
# status, the returned Call-Future's exception value will be an
|
||||
# RpcError.
|
||||
#
|
||||
continuation: Callable[[ClientCallDetails, _TRequest], _CallFuture[_TResponse]],
|
||||
client_call_details: ClientCallDetails,
|
||||
request: _TRequest,
|
||||
|
|
@ -407,7 +392,10 @@ class _CallIterator(Call, Generic[_TResponse], metaclass=abc.ABCMeta):
|
|||
def __iter__(self) -> Iterator[_TResponse]: ...
|
||||
def __next__(self) -> _TResponse: ...
|
||||
|
||||
class UnaryStreamClientInterceptor(abc.ABC, Generic[_TRequest, _TResponse]):
|
||||
class UnaryStreamClientInterceptor(abc.ABC):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return continuation(client_call_details, request)`.
|
||||
@abc.abstractmethod
|
||||
def intercept_unary_stream(
|
||||
self,
|
||||
|
|
@ -416,20 +404,26 @@ class UnaryStreamClientInterceptor(abc.ABC, Generic[_TRequest, _TResponse]):
|
|||
request: _TRequest,
|
||||
) -> _CallIterator[_TResponse]: ...
|
||||
|
||||
class StreamUnaryClientInterceptor(abc.ABC, Generic[_TRequest, _TResponse]):
|
||||
class StreamUnaryClientInterceptor(abc.ABC):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return continuation(client_call_details, request_iterator)`.
|
||||
@abc.abstractmethod
|
||||
def intercept_stream_unary(
|
||||
self,
|
||||
continuation: Callable[[ClientCallDetails, _TRequest], _CallFuture[_TResponse]],
|
||||
continuation: Callable[[ClientCallDetails, Iterator[_TRequest]], _CallFuture[_TResponse]],
|
||||
client_call_details: ClientCallDetails,
|
||||
request_iterator: Iterator[_TRequest],
|
||||
) -> _CallFuture[_TResponse]: ...
|
||||
|
||||
class StreamStreamClientInterceptor(abc.ABC, Generic[_TRequest, _TResponse]):
|
||||
class StreamStreamClientInterceptor(abc.ABC):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return continuation(client_call_details, request_iterator)`.
|
||||
@abc.abstractmethod
|
||||
def intercept_stream_stream(
|
||||
self,
|
||||
continuation: Callable[[ClientCallDetails, _TRequest], _CallIterator[_TResponse]],
|
||||
continuation: Callable[[ClientCallDetails, Iterator[_TRequest]], _CallIterator[_TResponse]],
|
||||
client_call_details: ClientCallDetails,
|
||||
request_iterator: Iterator[_TRequest],
|
||||
) -> _CallIterator[_TResponse]: ...
|
||||
|
|
@ -493,17 +487,21 @@ class HandlerCallDetails(abc.ABC):
|
|||
method: str
|
||||
invocation_metadata: _Metadata
|
||||
|
||||
class GenericRpcHandler(abc.ABC, Generic[_TRequest, _TResponse]):
|
||||
class GenericRpcHandler(abc.ABC):
|
||||
# The return type depends on the handler call details.
|
||||
@abc.abstractmethod
|
||||
def service(self, handler_call_details: HandlerCallDetails) -> RpcMethodHandler[_TRequest, _TResponse] | None: ...
|
||||
def service(self, handler_call_details: HandlerCallDetails) -> RpcMethodHandler[Any, Any] | None: ...
|
||||
|
||||
class ServiceRpcHandler(GenericRpcHandler[_TRequest, _TResponse], metaclass=abc.ABCMeta):
|
||||
class ServiceRpcHandler(GenericRpcHandler, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def service_name(self) -> str: ...
|
||||
|
||||
# Service-Side Interceptor:
|
||||
|
||||
class ServerInterceptor(abc.ABC, Generic[_TRequest, _TResponse]):
|
||||
class ServerInterceptor(abc.ABC):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return continuation(handler_call_details)`.
|
||||
@abc.abstractmethod
|
||||
def intercept_service(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ class AioRpcError(RpcError):
|
|||
|
||||
# Create Client:
|
||||
|
||||
class ClientInterceptor(metaclass=abc.ABCMeta): ...
|
||||
|
||||
def insecure_channel(
|
||||
target: str,
|
||||
options: _Options | None = None,
|
||||
|
|
@ -65,8 +63,8 @@ def secure_channel(
|
|||
|
||||
def server(
|
||||
migration_thread_pool: futures.Executor | None = None,
|
||||
handlers: Sequence[GenericRpcHandler[Any, Any]] | None = None,
|
||||
interceptors: Sequence[ServerInterceptor[Any, Any]] | None = None,
|
||||
handlers: Sequence[GenericRpcHandler] | None = None,
|
||||
interceptors: Sequence[ServerInterceptor] | None = None,
|
||||
options: _Options | None = None,
|
||||
maximum_concurrent_rpcs: int | None = None,
|
||||
compression: Compression | None = None,
|
||||
|
|
@ -125,7 +123,7 @@ class Channel(abc.ABC):
|
|||
|
||||
class Server(metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def add_generic_rpc_handlers(self, generic_rpc_handlers: Iterable[GenericRpcHandler[Any, Any]]) -> None: ...
|
||||
def add_generic_rpc_handlers(self, generic_rpc_handlers: Iterable[GenericRpcHandler]) -> None: ...
|
||||
|
||||
# Returns an integer port on which server will accept RPC requests.
|
||||
@abc.abstractmethod
|
||||
|
|
@ -288,7 +286,7 @@ class InterceptedUnaryUnaryCall(_InterceptedCall[_TRequest, _TResponse], metacla
|
|||
def __await__(self) -> Generator[Incomplete, None, _TResponse]: ...
|
||||
def __init__(
|
||||
self,
|
||||
interceptors: Sequence[UnaryUnaryClientInterceptor[_TRequest, _TResponse]],
|
||||
interceptors: Sequence[UnaryUnaryClientInterceptor],
|
||||
request: _TRequest,
|
||||
timeout: float | None,
|
||||
metadata: Metadata,
|
||||
|
|
@ -304,7 +302,7 @@ class InterceptedUnaryUnaryCall(_InterceptedCall[_TRequest, _TResponse], metacla
|
|||
# pylint: disable=too-many-arguments
|
||||
async def _invoke(
|
||||
self,
|
||||
interceptors: Sequence[UnaryUnaryClientInterceptor[_TRequest, _TResponse]],
|
||||
interceptors: Sequence[UnaryUnaryClientInterceptor],
|
||||
method: bytes,
|
||||
timeout: float | None,
|
||||
metadata: Metadata | None,
|
||||
|
|
@ -316,46 +314,67 @@ class InterceptedUnaryUnaryCall(_InterceptedCall[_TRequest, _TResponse], metacla
|
|||
) -> UnaryUnaryCall[_TRequest, _TResponse]: ...
|
||||
def time_remaining(self) -> float | None: ...
|
||||
|
||||
class UnaryUnaryClientInterceptor(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
|
||||
class ClientInterceptor(metaclass=abc.ABCMeta): ...
|
||||
|
||||
class UnaryUnaryClientInterceptor(ClientInterceptor, metaclass=abc.ABCMeta):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return await continuation(client_call_details, request)`.
|
||||
@abc.abstractmethod
|
||||
async def intercept_unary_unary(
|
||||
self,
|
||||
# XXX: See equivalent function in grpc types for notes about continuation:
|
||||
continuation: Callable[[ClientCallDetails, _TRequest], UnaryUnaryCall[_TRequest, _TResponse]],
|
||||
continuation: Callable[[ClientCallDetails, _TRequest], Awaitable[UnaryUnaryCall[_TRequest, _TResponse]]],
|
||||
client_call_details: ClientCallDetails,
|
||||
request: _TRequest,
|
||||
) -> _TResponse: ...
|
||||
) -> _TResponse | UnaryUnaryCall[_TRequest, _TResponse]: ...
|
||||
|
||||
class UnaryStreamClientInterceptor(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
|
||||
class UnaryStreamClientInterceptor(ClientInterceptor, metaclass=abc.ABCMeta):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return await continuation(client_call_details, request)`.
|
||||
@abc.abstractmethod
|
||||
async def intercept_unary_stream(
|
||||
self,
|
||||
continuation: Callable[[ClientCallDetails, _TRequest], UnaryStreamCall[_TRequest, _TResponse]],
|
||||
continuation: Callable[[ClientCallDetails, _TRequest], Awaitable[UnaryStreamCall[_TRequest, _TResponse]]],
|
||||
client_call_details: ClientCallDetails,
|
||||
request: _TRequest,
|
||||
) -> AsyncIterable[_TResponse] | UnaryStreamCall[_TRequest, _TResponse]: ...
|
||||
) -> AsyncIterator[_TResponse] | UnaryStreamCall[_TRequest, _TResponse]: ...
|
||||
|
||||
class StreamUnaryClientInterceptor(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
|
||||
class StreamUnaryClientInterceptor(ClientInterceptor, metaclass=abc.ABCMeta):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return await continuation(client_call_details, request_iterator)`.
|
||||
@abc.abstractmethod
|
||||
async def intercept_stream_unary(
|
||||
self,
|
||||
continuation: Callable[[ClientCallDetails, _TRequest], StreamUnaryCall[_TRequest, _TResponse]],
|
||||
continuation: Callable[
|
||||
[ClientCallDetails, AsyncIterable[_TRequest] | Iterable[_TRequest]], Awaitable[StreamUnaryCall[_TRequest, _TResponse]]
|
||||
],
|
||||
client_call_details: ClientCallDetails,
|
||||
request_iterator: AsyncIterable[_TRequest] | Iterable[_TRequest],
|
||||
) -> AsyncIterable[_TResponse] | UnaryStreamCall[_TRequest, _TResponse]: ...
|
||||
) -> _TResponse | StreamUnaryCall[_TRequest, _TResponse]: ...
|
||||
|
||||
class StreamStreamClientInterceptor(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
|
||||
class StreamStreamClientInterceptor(ClientInterceptor, metaclass=abc.ABCMeta):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return await continuation(client_call_details, request_iterator)`.
|
||||
@abc.abstractmethod
|
||||
async def intercept_stream_stream(
|
||||
self,
|
||||
continuation: Callable[[ClientCallDetails, _TRequest], StreamStreamCall[_TRequest, _TResponse]],
|
||||
continuation: Callable[
|
||||
[ClientCallDetails, AsyncIterable[_TRequest] | Iterable[_TRequest]],
|
||||
Awaitable[StreamStreamCall[_TRequest, _TResponse]],
|
||||
],
|
||||
client_call_details: ClientCallDetails,
|
||||
request_iterator: AsyncIterable[_TRequest] | Iterable[_TRequest],
|
||||
) -> AsyncIterable[_TResponse] | StreamStreamCall[_TRequest, _TResponse]: ...
|
||||
) -> AsyncIterator[_TResponse] | StreamStreamCall[_TRequest, _TResponse]: ...
|
||||
|
||||
# Server-Side Interceptor:
|
||||
|
||||
class ServerInterceptor(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
|
||||
class ServerInterceptor(metaclass=abc.ABCMeta):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse
|
||||
# and the types must satisfy the no-op implementation of
|
||||
# `return await continuation(handler_call_details)`.
|
||||
@abc.abstractmethod
|
||||
async def intercept_service(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
from argparse import ArgumentParser, Namespace
|
||||
from typing import Any
|
||||
from typing_extensions import override
|
||||
|
||||
from gunicorn.config import Config
|
||||
from gunicorn.glogging import Logger as GLogger
|
||||
|
|
@ -30,7 +29,5 @@ class Application(BaseApplication):
|
|||
def get_config_from_module_name(self, module_name: str) -> dict[str, Any]: ...
|
||||
def load_config_from_module_name_or_filename(self, location: str) -> dict[str, Any]: ...
|
||||
def load_config_from_file(self, filename: str) -> dict[str, Any]: ...
|
||||
@override
|
||||
def load_config(self) -> None: ...
|
||||
@override
|
||||
def run(self) -> None: ...
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
from argparse import ArgumentParser, Namespace
|
||||
from typing_extensions import override
|
||||
|
||||
from gunicorn.app.base import Application
|
||||
|
||||
|
|
@ -8,13 +7,10 @@ from .._types import _WSGIAppType
|
|||
class WSGIApplication(Application):
|
||||
app_uri: str | None
|
||||
|
||||
@override
|
||||
def init(self, parser: ArgumentParser, opts: Namespace, args: list[str]) -> None: ...
|
||||
@override
|
||||
def load_config(self) -> None: ...
|
||||
def load_wsgiapp(self) -> _WSGIAppType: ...
|
||||
def load_pasteapp(self) -> _WSGIAppType: ...
|
||||
@override
|
||||
def load(self) -> _WSGIAppType: ...
|
||||
|
||||
def run(prog: str | None = None) -> None: ...
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from _typeshed import ConvertibleToInt
|
|||
from collections.abc import Callable, Container
|
||||
from ssl import SSLContext, _SSLMethod
|
||||
from typing import Annotated, Any, ClassVar, overload
|
||||
from typing_extensions import TypeAlias, override
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from gunicorn.arbiter import Arbiter
|
||||
from gunicorn.glogging import Logger as GLogger
|
||||
|
|
@ -90,7 +90,6 @@ class Config:
|
|||
|
||||
def __init__(self, usage: str | None = None, prog: str | None = None) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
@override
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
def set(self, name: str, value: _ConfigValueType) -> None: ...
|
||||
def get_cmd_args_from_env(self) -> list[str]: ...
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
from logging.config import _DictConfigArgs
|
||||
from socket import SocketKind
|
||||
from typing import Annotated, Any, ClassVar, Literal, TypedDict, type_check_only
|
||||
from typing_extensions import TypeAlias, override
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from gunicorn.http import Request
|
||||
from gunicorn.http.wsgi import Response
|
||||
|
|
@ -52,7 +52,6 @@ def loggers() -> list[logging.Logger]: ...
|
|||
|
||||
class SafeAtoms(dict[str, Any]):
|
||||
def __init__(self, atoms: dict[str, Any]) -> None: ...
|
||||
@override
|
||||
def __getitem__(self, k: str) -> str: ...
|
||||
|
||||
_SyslogAddressType: TypeAlias = (
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue