Compare commits
10 Commits
0.8.6
...
extend-AIR
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3c483a545 | ||
|
|
c59cdd25de | ||
|
|
8026d7712c | ||
|
|
7ca2d283c1 | ||
|
|
316126cf38 | ||
|
|
39d545b738 | ||
|
|
aa049d5071 | ||
|
|
1743f029f1 | ||
|
|
1483804487 | ||
|
|
e292b7b277 |
10
.github/renovate.json5
vendored
10
.github/renovate.json5
vendored
@@ -45,7 +45,7 @@
|
||||
groupName: "Artifact GitHub Actions dependencies",
|
||||
matchManagers: ["github-actions"],
|
||||
matchDatasources: ["gitea-tags", "github-tags"],
|
||||
matchPackageNames: ["actions/.*-artifact"],
|
||||
matchPackagePatterns: ["actions/.*-artifact"],
|
||||
description: "Weekly update of artifact-related GitHub Actions dependencies",
|
||||
},
|
||||
{
|
||||
@@ -61,7 +61,7 @@
|
||||
{
|
||||
// Disable updates of `zip-rs`; intentionally pinned for now due to ownership change
|
||||
// See: https://github.com/astral-sh/uv/issues/3642
|
||||
matchPackageNames: ["zip"],
|
||||
matchPackagePatterns: ["zip"],
|
||||
matchManagers: ["cargo"],
|
||||
enabled: false,
|
||||
},
|
||||
@@ -70,7 +70,7 @@
|
||||
// with `mkdocs-material-insider`.
|
||||
// See: https://squidfunk.github.io/mkdocs-material/insiders/upgrade/
|
||||
matchManagers: ["pip_requirements"],
|
||||
matchPackageNames: ["mkdocs-material"],
|
||||
matchPackagePatterns: ["mkdocs-material"],
|
||||
enabled: false,
|
||||
},
|
||||
{
|
||||
@@ -87,13 +87,13 @@
|
||||
{
|
||||
groupName: "Monaco",
|
||||
matchManagers: ["npm"],
|
||||
matchPackageNames: ["monaco"],
|
||||
matchPackagePatterns: ["monaco"],
|
||||
description: "Weekly update of the Monaco editor",
|
||||
},
|
||||
{
|
||||
groupName: "strum",
|
||||
matchManagers: ["cargo"],
|
||||
matchPackageNames: ["strum"],
|
||||
matchPackagePatterns: ["strum"],
|
||||
description: "Weekly update of strum dependencies",
|
||||
},
|
||||
{
|
||||
|
||||
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@@ -386,7 +386,7 @@ jobs:
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup component add rustfmt
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: ./scripts/add_rule.py --name DoTheThing --prefix F --code 999 --linter pyflakes
|
||||
- run: ./scripts/add_rule.py --name DoTheThing --prefix PL --code C0999 --linter pylint
|
||||
- run: cargo check
|
||||
- run: cargo fmt --all --check
|
||||
- run: |
|
||||
|
||||
63
CHANGELOG.md
63
CHANGELOG.md
@@ -1,68 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 0.8.6
|
||||
|
||||
### Preview features
|
||||
|
||||
- \[`format`\]: Preserve multiline implicit concatenated strings in docstring positions ([#15126](https://github.com/astral-sh/ruff/pull/15126))
|
||||
- \[`ruff`\] Add rule to detect empty literal in deque call (`RUF025`) ([#15104](https://github.com/astral-sh/ruff/pull/15104))
|
||||
- \[`ruff`\] Avoid reporting when `ndigits` is possibly negative (`RUF057`) ([#15234](https://github.com/astral-sh/ruff/pull/15234))
|
||||
|
||||
### Rule changes
|
||||
|
||||
- \[`flake8-todos`\] remove issue code length restriction (`TD003`) ([#15175](https://github.com/astral-sh/ruff/pull/15175))
|
||||
- \[`pyflakes`\] Ignore errors in `@no_type_check` string annotations (`F722`, `F821`) ([#15215](https://github.com/astral-sh/ruff/pull/15215))
|
||||
|
||||
### CLI
|
||||
|
||||
- Show errors for attempted fixes only when passed `--verbose` ([#15237](https://github.com/astral-sh/ruff/pull/15237))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
- \[`ruff`\] Avoid syntax error when removing int over multiple lines (`RUF046`) ([#15230](https://github.com/astral-sh/ruff/pull/15230))
|
||||
- \[`pyupgrade`\] Revert "Add all PEP-585 names to `UP006` rule" ([#15250](https://github.com/astral-sh/ruff/pull/15250))
|
||||
|
||||
## 0.8.5
|
||||
|
||||
### Preview features
|
||||
|
||||
- \[`airflow`\] Extend names moved from core to provider (`AIR303`) ([#15145](https://github.com/astral-sh/ruff/pull/15145), [#15159](https://github.com/astral-sh/ruff/pull/15159), [#15196](https://github.com/astral-sh/ruff/pull/15196), [#15216](https://github.com/astral-sh/ruff/pull/15216))
|
||||
- \[`airflow`\] Extend rule to check class attributes, methods, arguments (`AIR302`) ([#15054](https://github.com/astral-sh/ruff/pull/15054), [#15083](https://github.com/astral-sh/ruff/pull/15083))
|
||||
- \[`fastapi`\] Update `FAST002` to check keyword-only arguments ([#15119](https://github.com/astral-sh/ruff/pull/15119))
|
||||
- \[`flake8-type-checking`\] Disable `TC006` and `TC007` in stub files ([#15179](https://github.com/astral-sh/ruff/pull/15179))
|
||||
- \[`pylint`\] Detect nested methods correctly (`PLW1641`) ([#15032](https://github.com/astral-sh/ruff/pull/15032))
|
||||
- \[`ruff`\] Detect more strict-integer expressions (`RUF046`) ([#14833](https://github.com/astral-sh/ruff/pull/14833))
|
||||
- \[`ruff`\] Implement `falsy-dict-get-fallback` (`RUF056`) ([#15160](https://github.com/astral-sh/ruff/pull/15160))
|
||||
- \[`ruff`\] Implement `unnecessary-round` (`RUF057`) ([#14828](https://github.com/astral-sh/ruff/pull/14828))
|
||||
|
||||
### Rule changes
|
||||
|
||||
- Visit PEP 764 inline `TypedDict` keys as non-type-expressions ([#15073](https://github.com/astral-sh/ruff/pull/15073))
|
||||
- \[`flake8-comprehensions`\] Skip `C416` if comprehension contains unpacking ([#14909](https://github.com/astral-sh/ruff/pull/14909))
|
||||
- \[`flake8-pie`\] Allow `cast(SomeType, ...)` (`PIE796`) ([#15141](https://github.com/astral-sh/ruff/pull/15141))
|
||||
- \[`flake8-simplify`\] More precise inference for dictionaries (`SIM300`) ([#15164](https://github.com/astral-sh/ruff/pull/15164))
|
||||
- \[`flake8-use-pathlib`\] Catch redundant joins in `PTH201` and avoid syntax errors ([#15177](https://github.com/astral-sh/ruff/pull/15177))
|
||||
- \[`pycodestyle`\] Preserve original value format (`E731`) ([#15097](https://github.com/astral-sh/ruff/pull/15097))
|
||||
- \[`pydocstyle`\] Split on first whitespace character (`D403`) ([#15082](https://github.com/astral-sh/ruff/pull/15082))
|
||||
- \[`pyupgrade`\] Add all PEP-585 names to `UP006` rule ([#5454](https://github.com/astral-sh/ruff/pull/5454))
|
||||
|
||||
### Configuration
|
||||
|
||||
- \[`flake8-type-checking`\] Improve flexibility of `runtime-evaluated-decorators` ([#15204](https://github.com/astral-sh/ruff/pull/15204))
|
||||
- \[`pydocstyle`\] Add setting to ignore missing documentation for `*args` and `**kwargs` parameters (`D417`) ([#15210](https://github.com/astral-sh/ruff/pull/15210))
|
||||
- \[`ruff`\] Add an allowlist for `unsafe-markup-use` (`RUF035`) ([#15076](https://github.com/astral-sh/ruff/pull/15076))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
- Fix type subscript on older python versions ([#15090](https://github.com/astral-sh/ruff/pull/15090))
|
||||
- Use `TypeChecker` for detecting `fastapi` routes ([#15093](https://github.com/astral-sh/ruff/pull/15093))
|
||||
- \[`pycodestyle`\] Avoid false positives and negatives related to type parameter default syntax (`E225`, `E251`) ([#15214](https://github.com/astral-sh/ruff/pull/15214))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Fix incorrect doc in `shebang-not-executable` (`EXE001`) and add git+windows solution to executable bit ([#15208](https://github.com/astral-sh/ruff/pull/15208))
|
||||
- Rename rules currently not conforming to naming convention ([#15102](https://github.com/astral-sh/ruff/pull/15102))
|
||||
|
||||
## 0.8.4
|
||||
|
||||
### Preview features
|
||||
|
||||
15
Cargo.lock
generated
15
Cargo.lock
generated
@@ -2520,7 +2520,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ruff"
|
||||
version = "0.8.6"
|
||||
version = "0.8.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"argfile",
|
||||
@@ -2739,7 +2739,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ruff_linter"
|
||||
version = "0.8.6"
|
||||
version = "0.8.4"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"annotate-snippets 0.9.2",
|
||||
@@ -2768,7 +2768,6 @@ dependencies = [
|
||||
"regex",
|
||||
"ruff_cache",
|
||||
"ruff_diagnostics",
|
||||
"ruff_index",
|
||||
"ruff_macros",
|
||||
"ruff_notebook",
|
||||
"ruff_python_ast",
|
||||
@@ -2970,7 +2969,6 @@ dependencies = [
|
||||
"rustc-hash 2.1.0",
|
||||
"schemars",
|
||||
"serde",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3056,7 +3054,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ruff_wasm"
|
||||
version = "0.8.6"
|
||||
version = "0.8.4"
|
||||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"console_log",
|
||||
@@ -3198,7 +3196,7 @@ checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
|
||||
[[package]]
|
||||
name = "salsa"
|
||||
version = "0.18.0"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=88a1d7774d78f048fbd77d40abca9ebd729fd1f0#88a1d7774d78f048fbd77d40abca9ebd729fd1f0"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=3c7f1694c9efba751dbeeacfbc93b227586e316a#3c7f1694c9efba751dbeeacfbc93b227586e316a"
|
||||
dependencies = [
|
||||
"append-only-vec",
|
||||
"arc-swap",
|
||||
@@ -3206,6 +3204,7 @@ dependencies = [
|
||||
"dashmap 6.1.0",
|
||||
"hashlink",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"parking_lot",
|
||||
"rayon",
|
||||
"rustc-hash 2.1.0",
|
||||
@@ -3218,12 +3217,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "salsa-macro-rules"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=88a1d7774d78f048fbd77d40abca9ebd729fd1f0#88a1d7774d78f048fbd77d40abca9ebd729fd1f0"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=3c7f1694c9efba751dbeeacfbc93b227586e316a#3c7f1694c9efba751dbeeacfbc93b227586e316a"
|
||||
|
||||
[[package]]
|
||||
name = "salsa-macros"
|
||||
version = "0.18.0"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=88a1d7774d78f048fbd77d40abca9ebd729fd1f0#88a1d7774d78f048fbd77d40abca9ebd729fd1f0"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=3c7f1694c9efba751dbeeacfbc93b227586e316a#3c7f1694c9efba751dbeeacfbc93b227586e316a"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
|
||||
@@ -119,7 +119,7 @@ rayon = { version = "1.10.0" }
|
||||
regex = { version = "1.10.2" }
|
||||
rustc-hash = { version = "2.0.0" }
|
||||
# When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml`
|
||||
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "88a1d7774d78f048fbd77d40abca9ebd729fd1f0" }
|
||||
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "3c7f1694c9efba751dbeeacfbc93b227586e316a" }
|
||||
schemars = { version = "0.8.16" }
|
||||
seahash = { version = "4.1.0" }
|
||||
serde = { version = "1.0.197", features = ["derive"] }
|
||||
|
||||
@@ -140,8 +140,8 @@ curl -LsSf https://astral.sh/ruff/install.sh | sh
|
||||
powershell -c "irm https://astral.sh/ruff/install.ps1 | iex"
|
||||
|
||||
# For a specific version.
|
||||
curl -LsSf https://astral.sh/ruff/0.8.6/install.sh | sh
|
||||
powershell -c "irm https://astral.sh/ruff/0.8.6/install.ps1 | iex"
|
||||
curl -LsSf https://astral.sh/ruff/0.8.4/install.sh | sh
|
||||
powershell -c "irm https://astral.sh/ruff/0.8.4/install.ps1 | iex"
|
||||
```
|
||||
|
||||
You can also install Ruff via [Homebrew](https://formulae.brew.sh/formula/ruff), [Conda](https://anaconda.org/conda-forge/ruff),
|
||||
@@ -174,7 +174,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com/) hook via [`ruff
|
||||
```yaml
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.8.6
|
||||
rev: v0.8.4
|
||||
hooks:
|
||||
# Run the linter.
|
||||
- id: ruff
|
||||
@@ -196,7 +196,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/ruff-action@v3
|
||||
- uses: astral-sh/ruff-action@v1
|
||||
```
|
||||
|
||||
### Configuration<a id="configuration"></a>
|
||||
|
||||
@@ -705,6 +705,13 @@ impl<'db> Type<'db> {
|
||||
Self::BytesLiteral(BytesLiteralType::new(db, bytes))
|
||||
}
|
||||
|
||||
pub fn tuple<T: Into<Type<'db>>>(
|
||||
db: &'db dyn Db,
|
||||
elements: impl IntoIterator<Item = T>,
|
||||
) -> Self {
|
||||
TupleType::from_elements(db, elements)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn negate(&self, db: &'db dyn Db) -> Type<'db> {
|
||||
IntersectionBuilder::new(db).add_negative(*self).build()
|
||||
@@ -1010,6 +1017,26 @@ impl<'db> Type<'db> {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: The following is a workaround that is required to unify the two different versions
|
||||
// of `NoneType` and `NoDefaultType` in typeshed. This should not be required anymore once
|
||||
// we understand `sys.version_info` branches.
|
||||
if let (
|
||||
Type::Instance(InstanceType { class: self_class }),
|
||||
Type::Instance(InstanceType {
|
||||
class: target_class,
|
||||
}),
|
||||
) = (self, other)
|
||||
{
|
||||
let self_known = self_class.known(db);
|
||||
if matches!(
|
||||
self_known,
|
||||
Some(KnownClass::NoneType | KnownClass::NoDefaultType)
|
||||
) && self_known == target_class.known(db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// type[object] ≡ type
|
||||
if let (
|
||||
Type::SubclassOf(SubclassOfType {
|
||||
@@ -2091,16 +2118,15 @@ impl<'db> Type<'db> {
|
||||
Type::Union(UnionType::new(db, elements))
|
||||
};
|
||||
|
||||
TupleType::from_elements(
|
||||
db,
|
||||
[
|
||||
Type::IntLiteral(python_version.major.into()),
|
||||
Type::IntLiteral(python_version.minor.into()),
|
||||
int_instance_ty,
|
||||
release_level_ty,
|
||||
int_instance_ty,
|
||||
],
|
||||
)
|
||||
let version_info_elements = &[
|
||||
Type::IntLiteral(python_version.major.into()),
|
||||
Type::IntLiteral(python_version.minor.into()),
|
||||
int_instance_ty,
|
||||
release_level_ty,
|
||||
int_instance_ty,
|
||||
];
|
||||
|
||||
Self::tuple(db, version_info_elements)
|
||||
}
|
||||
|
||||
/// Given a type that is assumed to represent an instance of a class,
|
||||
@@ -3409,8 +3435,8 @@ impl<'db> Class<'db> {
|
||||
/// The member resolves to a member on the class itself or any of its proper superclasses.
|
||||
pub(crate) fn class_member(self, db: &'db dyn Db, name: &str) -> Symbol<'db> {
|
||||
if name == "__mro__" {
|
||||
let tuple_elements = self.iter_mro(db).map(Type::from);
|
||||
return TupleType::from_elements(db, tuple_elements).into();
|
||||
let tuple_elements: Vec<Type<'db>> = self.iter_mro(db).map(Type::from).collect();
|
||||
return Type::tuple(db, &tuple_elements).into();
|
||||
}
|
||||
|
||||
for superclass in self.iter_mro(db) {
|
||||
@@ -3820,7 +3846,7 @@ pub(crate) mod tests {
|
||||
}
|
||||
Ty::Tuple(tys) => {
|
||||
let elements = tys.into_iter().map(|ty| ty.into_type(db));
|
||||
TupleType::from_elements(db, elements)
|
||||
Type::tuple(db, elements)
|
||||
}
|
||||
Ty::SubclassOfAny => Type::subclass_of_base(ClassBase::Any),
|
||||
Ty::SubclassOfUnknown => Type::subclass_of_base(ClassBase::Unknown),
|
||||
|
||||
@@ -2672,12 +2672,10 @@ impl<'db> TypeInferenceBuilder<'db> {
|
||||
parenthesized: _,
|
||||
} = tuple;
|
||||
|
||||
// Collecting all elements is necessary to infer all sub-expressions even if some
|
||||
// element types are `Never` (which leads `from_elements` to return early without
|
||||
// consuming the whole iterator).
|
||||
let element_types: Vec<_> = elts.iter().map(|elt| self.infer_expression(elt)).collect();
|
||||
let element_types: Vec<Type<'db>> =
|
||||
elts.iter().map(|elt| self.infer_expression(elt)).collect();
|
||||
|
||||
TupleType::from_elements(self.db(), element_types)
|
||||
Type::tuple(self.db(), &element_types)
|
||||
}
|
||||
|
||||
fn infer_list_expression(&mut self, list: &ast::ExprList) -> Type<'db> {
|
||||
@@ -4241,7 +4239,8 @@ impl<'db> TypeInferenceBuilder<'db> {
|
||||
let (start, stop, step) = slice_ty.as_tuple(self.db());
|
||||
|
||||
if let Ok(new_elements) = elements.py_slice(start, stop, step) {
|
||||
TupleType::from_elements(self.db(), new_elements)
|
||||
let new_elements: Vec<_> = new_elements.copied().collect();
|
||||
Type::tuple(self.db(), &new_elements)
|
||||
} else {
|
||||
report_slice_step_size_zero(&self.context, value_node.into());
|
||||
Type::Unknown
|
||||
@@ -4843,7 +4842,7 @@ impl<'db> TypeInferenceBuilder<'db> {
|
||||
let ty = if return_todo {
|
||||
todo_type!("full tuple[...] support")
|
||||
} else {
|
||||
TupleType::from_elements(self.db(), element_types)
|
||||
Type::tuple(self.db(), &element_types)
|
||||
};
|
||||
|
||||
// Here, we store the type for the inner `int, str` tuple-expression,
|
||||
@@ -4858,7 +4857,7 @@ impl<'db> TypeInferenceBuilder<'db> {
|
||||
if element_could_alter_type_of_whole_tuple(single_element, single_element_ty) {
|
||||
todo_type!("full tuple[...] support")
|
||||
} else {
|
||||
TupleType::from_elements(self.db(), std::iter::once(single_element_ty))
|
||||
Type::tuple(self.db(), [single_element_ty])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ impl<'db> Unpacker<'db> {
|
||||
// with each individual character, instead of just an array of
|
||||
// `LiteralString`, but there would be a cost and it's not clear that
|
||||
// it's worth it.
|
||||
TupleType::from_elements(
|
||||
Type::tuple(
|
||||
self.db(),
|
||||
std::iter::repeat(Type::LiteralString)
|
||||
.take(string_literal_ty.python_len(self.db())),
|
||||
|
||||
@@ -6,11 +6,10 @@ use red_knot_python_semantic::types::check_types;
|
||||
use red_knot_python_semantic::Program;
|
||||
use ruff_db::diagnostic::{Diagnostic, ParseDiagnostic};
|
||||
use ruff_db::files::{system_path_to_file, File, Files};
|
||||
use ruff_db::panic::catch_unwind;
|
||||
use ruff_db::parsed::parsed_module;
|
||||
use ruff_db::system::{DbWithTestSystem, SystemPathBuf};
|
||||
use ruff_db::testing::{setup_logging, setup_logging_with_filter};
|
||||
use ruff_source_file::{LineIndex, OneIndexed};
|
||||
use ruff_source_file::LineIndex;
|
||||
use ruff_text_size::TextSize;
|
||||
use salsa::Setter;
|
||||
|
||||
@@ -137,20 +136,7 @@ fn run_test(db: &mut db::Db, test: &parser::MarkdownTest) -> Result<(), Failures
|
||||
})
|
||||
.collect();
|
||||
|
||||
let type_diagnostics = match catch_unwind(|| check_types(db, test_file.file)) {
|
||||
Ok(type_diagnostics) => type_diagnostics,
|
||||
Err(info) => {
|
||||
let mut by_line = matcher::FailuresByLine::default();
|
||||
by_line.push(
|
||||
OneIndexed::from_zero_indexed(0),
|
||||
info.info.split('\n').map(String::from).collect(),
|
||||
);
|
||||
return Some(FileFailures {
|
||||
backtick_offset: test_file.backtick_offset,
|
||||
by_line,
|
||||
});
|
||||
}
|
||||
};
|
||||
let type_diagnostics = check_types(db, test_file.file);
|
||||
diagnostics.extend(type_diagnostics.into_iter().map(|diagnostic| {
|
||||
let diagnostic: Box<dyn Diagnostic> = Box::new((*diagnostic).clone());
|
||||
diagnostic
|
||||
|
||||
@@ -27,7 +27,7 @@ impl FailuresByLine {
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn push(&mut self, line_number: OneIndexed, messages: Vec<String>) {
|
||||
fn push(&mut self, line_number: OneIndexed, messages: Vec<String>) {
|
||||
let start = self.failures.len();
|
||||
self.failures.extend(messages);
|
||||
self.lines.push(LineFailures {
|
||||
|
||||
@@ -1 +1 @@
|
||||
2047b820730fdd65d37e6e8efcf29ca9af7ec3e7
|
||||
fc11e835108394728930059c8db5b436209bc957
|
||||
|
||||
@@ -65,7 +65,7 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
|
||||
self,
|
||||
coro: _TaskCompatibleCoro[_T_co],
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
loop: AbstractEventLoop = ...,
|
||||
name: str | None = ...,
|
||||
context: Context | None = None,
|
||||
eager_start: bool = False,
|
||||
@@ -75,13 +75,13 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
|
||||
self,
|
||||
coro: _TaskCompatibleCoro[_T_co],
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
loop: AbstractEventLoop = ...,
|
||||
name: str | None = ...,
|
||||
context: Context | None = None,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = ...
|
||||
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop = ..., name: str | None = ...
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
|
||||
@@ -22,8 +22,8 @@ class blake2b:
|
||||
digest_size: int
|
||||
name: str
|
||||
if sys.version_info >= (3, 9):
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
data: ReadableBuffer = b"",
|
||||
/,
|
||||
*,
|
||||
@@ -39,10 +39,10 @@ class blake2b:
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
usedforsecurity: bool = True,
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
data: ReadableBuffer = b"",
|
||||
/,
|
||||
*,
|
||||
@@ -57,7 +57,7 @@ class blake2b:
|
||||
node_depth: int = 0,
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
|
||||
def copy(self) -> Self: ...
|
||||
def digest(self) -> bytes: ...
|
||||
@@ -74,8 +74,8 @@ class blake2s:
|
||||
digest_size: int
|
||||
name: str
|
||||
if sys.version_info >= (3, 9):
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
data: ReadableBuffer = b"",
|
||||
/,
|
||||
*,
|
||||
@@ -91,10 +91,10 @@ class blake2s:
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
usedforsecurity: bool = True,
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
data: ReadableBuffer = b"",
|
||||
/,
|
||||
*,
|
||||
@@ -109,7 +109,7 @@ class blake2s:
|
||||
node_depth: int = 0,
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
|
||||
def copy(self) -> Self: ...
|
||||
def digest(self) -> bytes: ...
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from typing import final
|
||||
from typing_extensions import Self
|
||||
|
||||
@final
|
||||
class BZ2Compressor:
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, compresslevel: int = 9, /) -> Self: ...
|
||||
else:
|
||||
def __init__(self, compresslevel: int = 9, /) -> None: ...
|
||||
|
||||
def __init__(self, compresslevel: int = 9) -> None: ...
|
||||
def compress(self, data: ReadableBuffer, /) -> bytes: ...
|
||||
def flush(self) -> bytes: ...
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ from typing import ( # noqa: Y022,Y038
|
||||
AsyncIterator as AsyncIterator,
|
||||
Awaitable as Awaitable,
|
||||
Callable as Callable,
|
||||
ClassVar,
|
||||
Collection as Collection,
|
||||
Container as Container,
|
||||
Coroutine as Coroutine,
|
||||
@@ -75,7 +74,6 @@ _VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers.
|
||||
class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __reversed__(self) -> Iterator[_KT_co]: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
if sys.version_info >= (3, 13):
|
||||
def isdisjoint(self, other: Iterable[_KT_co], /) -> bool: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@@ -93,7 +91,6 @@ class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented
|
||||
class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
if sys.version_info >= (3, 13):
|
||||
def isdisjoint(self, other: Iterable[tuple[_KT_co, _VT_co]], /) -> bool: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from collections.abc import Callable, Iterator, Mapping
|
||||
from typing import Any, ClassVar, Generic, TypeVar, final, overload
|
||||
from typing_extensions import ParamSpec, Self
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
@@ -13,9 +13,9 @@ _P = ParamSpec("_P")
|
||||
@final
|
||||
class ContextVar(Generic[_T]):
|
||||
@overload
|
||||
def __new__(cls, name: str) -> Self: ...
|
||||
def __init__(self, name: str) -> None: ...
|
||||
@overload
|
||||
def __new__(cls, name: str, *, default: _T) -> Self: ...
|
||||
def __init__(self, name: str, *, default: _T) -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
@@ -37,7 +37,6 @@ class Token(Generic[_T]):
|
||||
@property
|
||||
def old_value(self) -> Any: ... # returns either _T or MISSING, but that's hard to express
|
||||
MISSING: ClassVar[object]
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
@@ -56,7 +55,6 @@ class Context(Mapping[ContextVar[Any], Any]):
|
||||
def get(self, key: ContextVar[_T], default: _D, /) -> _T | _D: ...
|
||||
def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ...
|
||||
def copy(self) -> Context: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __getitem__(self, key: ContextVar[_T], /) -> _T: ...
|
||||
def __iter__(self) -> Iterator[ContextVar[Any]]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@@ -32,8 +32,8 @@ class Dialect:
|
||||
lineterminator: str
|
||||
quoting: _QuotingType
|
||||
strict: bool
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
dialect: _DialectLike | None = ...,
|
||||
delimiter: str = ",",
|
||||
doublequote: bool = True,
|
||||
@@ -43,7 +43,7 @@ class Dialect:
|
||||
quoting: _QuotingType = 0,
|
||||
skipinitialspace: bool = False,
|
||||
strict: bool = False,
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
# This class calls itself _csv.reader.
|
||||
@@ -115,7 +115,7 @@ def reader(
|
||||
) -> _reader: ...
|
||||
def register_dialect(
|
||||
name: str,
|
||||
dialect: type[Dialect | csv.Dialect] = ...,
|
||||
dialect: type[Dialect] = ...,
|
||||
*,
|
||||
delimiter: str = ",",
|
||||
quotechar: str | None = '"',
|
||||
|
||||
@@ -169,18 +169,18 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType):
|
||||
# Abstract attribute that must be defined on subclasses
|
||||
_flags_: ClassVar[int]
|
||||
@overload
|
||||
def __new__(cls) -> Self: ...
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __new__(cls, address: int, /) -> Self: ...
|
||||
def __init__(self, address: int, /) -> None: ...
|
||||
@overload
|
||||
def __new__(cls, callable: Callable[..., Any], /) -> Self: ...
|
||||
def __init__(self, callable: Callable[..., Any], /) -> None: ...
|
||||
@overload
|
||||
def __new__(cls, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] | None = ..., /) -> Self: ...
|
||||
def __init__(self, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] | None = ..., /) -> None: ...
|
||||
if sys.platform == "win32":
|
||||
@overload
|
||||
def __new__(
|
||||
cls, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | _CDataType | None = ..., /
|
||||
) -> Self: ...
|
||||
def __init__(
|
||||
self, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | _CDataType | None = ..., /
|
||||
) -> None: ...
|
||||
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import ReadOnlyBuffer, SupportsRead, SupportsWrite
|
||||
from _typeshed import ReadOnlyBuffer, SupportsRead
|
||||
from curses import _ncurses_version
|
||||
from typing import Any, final, overload
|
||||
from typing import IO, Any, final, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
# NOTE: This module is ordinarily only available on Unix, but the windows-curses
|
||||
@@ -517,7 +517,7 @@ class window: # undocumented
|
||||
def overwrite(
|
||||
self, destwin: window, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int
|
||||
) -> None: ...
|
||||
def putwin(self, file: SupportsWrite[bytes], /) -> None: ...
|
||||
def putwin(self, file: IO[Any], /) -> None: ...
|
||||
def redrawln(self, beg: int, num: int, /) -> None: ...
|
||||
def redrawwin(self) -> None: ...
|
||||
@overload
|
||||
|
||||
@@ -5,7 +5,7 @@ import types
|
||||
from _typeshed.importlib import LoaderProtocol
|
||||
from collections.abc import Mapping, Sequence
|
||||
from types import ModuleType
|
||||
from typing import Any, ClassVar
|
||||
from typing import Any
|
||||
|
||||
# Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
|
||||
def __import__(
|
||||
@@ -43,7 +43,6 @@ class ModuleSpec:
|
||||
def parent(self) -> str | None: ...
|
||||
has_location: bool
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
|
||||
@@ -112,7 +112,7 @@ class BufferedRandom(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore
|
||||
def truncate(self, pos: int | None = None, /) -> int: ...
|
||||
|
||||
class BufferedRWPair(BufferedIOBase, _BufferedIOBase):
|
||||
def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = 8192, /) -> None: ...
|
||||
def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = 8192) -> None: ...
|
||||
def peek(self, size: int = 0, /) -> bytes: ...
|
||||
|
||||
class _TextIOBase(_IOBase):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from collections.abc import Callable
|
||||
from typing import Any, final
|
||||
from typing_extensions import Self
|
||||
|
||||
@final
|
||||
class make_encoder:
|
||||
@@ -20,8 +19,8 @@ class make_encoder:
|
||||
def encoder(self) -> Callable[[str], str]: ...
|
||||
@property
|
||||
def item_separator(self) -> str: ...
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
markers: dict[int, Any] | None,
|
||||
default: Callable[[Any], Any],
|
||||
encoder: Callable[[str], str],
|
||||
@@ -31,7 +30,7 @@ class make_encoder:
|
||||
sort_keys: bool,
|
||||
skipkeys: bool,
|
||||
allow_nan: bool,
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
def __call__(self, obj: object, _current_indent_level: int) -> Any: ...
|
||||
|
||||
@final
|
||||
@@ -43,7 +42,7 @@ class make_scanner:
|
||||
parse_float: Any
|
||||
strict: bool
|
||||
# TODO: 'context' needs the attrs above (ducktype), but not __call__.
|
||||
def __new__(cls, context: make_scanner) -> Self: ...
|
||||
def __init__(self, context: make_scanner) -> None: ...
|
||||
def __call__(self, string: str, index: int) -> tuple[Any, int]: ...
|
||||
|
||||
def encode_basestring(s: str, /) -> str: ...
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Mapping, Sequence
|
||||
from typing import Any, Final, final
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_FilterChain: TypeAlias = Sequence[Mapping[str, Any]]
|
||||
|
||||
@@ -37,11 +36,7 @@ PRESET_EXTREME: int # v big number
|
||||
|
||||
@final
|
||||
class LZMADecompressor:
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> Self: ...
|
||||
else:
|
||||
def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ...
|
||||
|
||||
def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ...
|
||||
def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ...
|
||||
@property
|
||||
def check(self) -> int: ...
|
||||
@@ -54,15 +49,9 @@ class LZMADecompressor:
|
||||
|
||||
@final
|
||||
class LZMACompressor:
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(
|
||||
cls, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
|
||||
) -> None: ...
|
||||
|
||||
def __init__(
|
||||
self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
|
||||
) -> None: ...
|
||||
def compress(self, data: ReadableBuffer, /) -> bytes: ...
|
||||
def flush(self) -> bytes: ...
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ class Pickler:
|
||||
self,
|
||||
file: SupportsWrite[bytes],
|
||||
protocol: int | None = None,
|
||||
*,
|
||||
fix_imports: bool = True,
|
||||
buffer_callback: _BufferCallback = None,
|
||||
) -> None: ...
|
||||
|
||||
@@ -12,7 +12,7 @@ from ssl import (
|
||||
SSLWantWriteError as SSLWantWriteError,
|
||||
SSLZeroReturnError as SSLZeroReturnError,
|
||||
)
|
||||
from typing import Any, ClassVar, Literal, TypedDict, final, overload
|
||||
from typing import Any, Literal, TypedDict, final, overload
|
||||
from typing_extensions import NotRequired, Self, TypeAlias
|
||||
|
||||
_PasswordType: TypeAlias = Callable[[], str | bytes | bytearray] | str | bytes | bytearray
|
||||
@@ -119,7 +119,6 @@ class MemoryBIO:
|
||||
|
||||
@final
|
||||
class SSLSession:
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
@property
|
||||
def has_ticket(self) -> bool: ...
|
||||
@property
|
||||
|
||||
@@ -13,11 +13,17 @@ error = RuntimeError
|
||||
|
||||
def _count() -> int: ...
|
||||
@final
|
||||
class RLock:
|
||||
class LockType:
|
||||
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
__enter__ = acquire
|
||||
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
def locked(self) -> bool: ...
|
||||
def acquire_lock(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
||||
def release_lock(self) -> None: ...
|
||||
def locked_lock(self) -> bool: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
@final
|
||||
@@ -31,33 +37,7 @@ if sys.version_info >= (3, 13):
|
||||
def start_joinable_thread(
|
||||
function: Callable[[], object], handle: _ThreadHandle | None = None, daemon: bool = True
|
||||
) -> _ThreadHandle: ...
|
||||
@final
|
||||
class lock:
|
||||
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
def locked(self) -> bool: ...
|
||||
def acquire_lock(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
||||
def release_lock(self) -> None: ...
|
||||
def locked_lock(self) -> bool: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
LockType = lock
|
||||
else:
|
||||
@final
|
||||
class LockType:
|
||||
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
def locked(self) -> bool: ...
|
||||
def acquire_lock(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
||||
def release_lock(self) -> None: ...
|
||||
def locked_lock(self) -> bool: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
) -> None: ...
|
||||
lock = LockType
|
||||
|
||||
@overload
|
||||
def start_new_thread(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]], /) -> int: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from collections.abc import Iterable, Iterator, MutableSet
|
||||
from typing import Any, ClassVar, TypeVar, overload
|
||||
from typing import Any, TypeVar, overload
|
||||
from typing_extensions import Self
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -21,7 +21,6 @@ class WeakSet(MutableSet[_T]):
|
||||
def copy(self) -> Self: ...
|
||||
def remove(self, item: _T) -> None: ...
|
||||
def update(self, other: Iterable[_T]) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __contains__(self, item: object) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import sys
|
||||
from _typeshed import SupportsWrite, sentinel
|
||||
from _typeshed import sentinel
|
||||
from collections.abc import Callable, Generator, Iterable, Sequence
|
||||
from re import Pattern
|
||||
from typing import IO, Any, ClassVar, Final, Generic, NewType, NoReturn, Protocol, TypeVar, overload
|
||||
from typing import IO, Any, Final, Generic, NewType, NoReturn, Protocol, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
|
||||
__all__ = [
|
||||
@@ -207,8 +207,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
help: str | None = None,
|
||||
metavar: str | None = None,
|
||||
) -> _SubParsersAction[_ArgumentParserT]: ...
|
||||
def print_usage(self, file: SupportsWrite[str] | None = None) -> None: ...
|
||||
def print_help(self, file: SupportsWrite[str] | None = None) -> None: ...
|
||||
def print_usage(self, file: IO[str] | None = None) -> None: ...
|
||||
def print_help(self, file: IO[str] | None = None) -> None: ...
|
||||
def format_usage(self) -> str: ...
|
||||
def format_help(self) -> str: ...
|
||||
@overload
|
||||
@@ -254,7 +254,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
def _get_value(self, action: Action, arg_string: str) -> Any: ...
|
||||
def _check_value(self, action: Action, value: Any) -> None: ...
|
||||
def _get_formatter(self) -> HelpFormatter: ...
|
||||
def _print_message(self, message: str, file: SupportsWrite[str] | None = None) -> None: ...
|
||||
def _print_message(self, message: str, file: IO[str] | None = None) -> None: ...
|
||||
|
||||
class HelpFormatter:
|
||||
# undocumented
|
||||
@@ -456,7 +456,6 @@ class Namespace(_AttributeHolder):
|
||||
def __setattr__(self, name: str, value: Any, /) -> None: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class FileType:
|
||||
# undocumented
|
||||
|
||||
@@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite
|
||||
from collections.abc import Iterable
|
||||
|
||||
# pytype crashes if array inherits from collections.abc.MutableSequence instead of typing.MutableSequence
|
||||
from typing import Any, ClassVar, Literal, MutableSequence, SupportsIndex, TypeVar, overload # noqa: Y022
|
||||
from typing import Any, Literal, MutableSequence, SupportsIndex, TypeVar, overload # noqa: Y022
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
@@ -24,21 +24,19 @@ class array(MutableSequence[_T]):
|
||||
@property
|
||||
def itemsize(self) -> int: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls: type[array[int]], typecode: _IntTypeCode, initializer: bytes | bytearray | Iterable[int] = ..., /
|
||||
) -> array[int]: ...
|
||||
def __init__(self: array[int], typecode: _IntTypeCode, initializer: bytes | bytearray | Iterable[int] = ..., /) -> None: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls: type[array[float]], typecode: _FloatTypeCode, initializer: bytes | bytearray | Iterable[float] = ..., /
|
||||
) -> array[float]: ...
|
||||
def __init__(
|
||||
self: array[float], typecode: _FloatTypeCode, initializer: bytes | bytearray | Iterable[float] = ..., /
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls: type[array[str]], typecode: _UnicodeTypeCode, initializer: bytes | bytearray | Iterable[str] = ..., /
|
||||
) -> array[str]: ...
|
||||
def __init__(
|
||||
self: array[str], typecode: _UnicodeTypeCode, initializer: bytes | bytearray | Iterable[str] = ..., /
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __new__(cls, typecode: str, initializer: Iterable[_T], /) -> Self: ...
|
||||
def __init__(self, typecode: str, initializer: Iterable[_T], /) -> None: ...
|
||||
@overload
|
||||
def __new__(cls, typecode: str, initializer: bytes | bytearray = ..., /) -> Self: ...
|
||||
def __init__(self, typecode: str, initializer: bytes | bytearray = ..., /) -> None: ...
|
||||
def append(self, v: _T, /) -> None: ...
|
||||
def buffer_info(self) -> tuple[int, int]: ...
|
||||
def byteswap(self) -> None: ...
|
||||
@@ -64,7 +62,6 @@ class array(MutableSequence[_T]):
|
||||
def fromstring(self, buffer: str | ReadableBuffer, /) -> None: ...
|
||||
def tostring(self) -> bytes: ...
|
||||
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __len__(self) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, key: SupportsIndex, /) -> _T: ...
|
||||
|
||||
@@ -7,7 +7,7 @@ from _ast import (
|
||||
PyCF_TYPE_COMMENTS as PyCF_TYPE_COMMENTS,
|
||||
)
|
||||
from _typeshed import ReadableBuffer, Unused
|
||||
from collections.abc import Iterable, Iterator
|
||||
from collections.abc import Iterator
|
||||
from typing import Any, ClassVar, Generic, Literal, TypedDict, TypeVar as _TypeVar, overload
|
||||
from typing_extensions import Self, Unpack, deprecated
|
||||
|
||||
@@ -1154,7 +1154,6 @@ class Tuple(expr):
|
||||
if sys.version_info >= (3, 14):
|
||||
def __replace__(self, *, elts: list[expr] = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
|
||||
@deprecated("Deprecated since Python 3.9.")
|
||||
class slice(AST): ... # deprecated and moved to ast.py for >= (3, 9)
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -1186,38 +1185,22 @@ class Slice(_Slice):
|
||||
**kwargs: Unpack[_SliceAttributes],
|
||||
) -> Self: ...
|
||||
|
||||
@deprecated("Deprecated since Python 3.9. Use ast.Tuple instead.")
|
||||
class ExtSlice(slice): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
|
||||
if sys.version_info >= (3, 9):
|
||||
def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_SliceAttributes]) -> Tuple: ... # type: ignore[misc]
|
||||
else:
|
||||
dims: list[slice]
|
||||
def __init__(self, dims: list[slice], **kwargs: Unpack[_SliceAttributes]) -> None: ...
|
||||
dims: list[slice]
|
||||
def __init__(self, dims: list[slice], **kwargs: Unpack[_SliceAttributes]) -> None: ...
|
||||
|
||||
@deprecated("Deprecated since Python 3.9. Use the index value directly instead.")
|
||||
class Index(slice): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
|
||||
if sys.version_info >= (3, 9):
|
||||
def __new__(cls, value: expr, **kwargs: Unpack[_SliceAttributes]) -> expr: ... # type: ignore[misc]
|
||||
else:
|
||||
value: expr
|
||||
def __init__(self, value: expr, **kwargs: Unpack[_SliceAttributes]) -> None: ...
|
||||
value: expr
|
||||
def __init__(self, value: expr, **kwargs: Unpack[_SliceAttributes]) -> None: ...
|
||||
|
||||
class expr_context(AST): ...
|
||||
|
||||
@deprecated("Deprecated since Python 3.9. Unused in Python 3.")
|
||||
class AugLoad(expr_context): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9)
|
||||
|
||||
@deprecated("Deprecated since Python 3.9. Unused in Python 3.")
|
||||
class AugStore(expr_context): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9)
|
||||
|
||||
@deprecated("Deprecated since Python 3.9. Unused in Python 3.")
|
||||
class Param(expr_context): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9)
|
||||
|
||||
@deprecated("Deprecated since Python 3.9. Unused in Python 3.")
|
||||
class Suite(mod): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
|
||||
if sys.version_info < (3, 9):
|
||||
body: list[stmt]
|
||||
def __init__(self, body: list[stmt]) -> None: ...
|
||||
body: list[stmt]
|
||||
def __init__(self, body: list[stmt]) -> None: ...
|
||||
|
||||
class Load(expr_context): ...
|
||||
class Store(expr_context): ...
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,6 @@ from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Literal, TypeVar, overload
|
||||
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = ("BaseEventLoop", "Server")
|
||||
else:
|
||||
@@ -453,7 +452,6 @@ class BaseEventLoop(AbstractEventLoop):
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
**kwargs: Any,
|
||||
) -> tuple[SubprocessTransport, _ProtocolT]: ...
|
||||
def add_reader(self, fd: FileDescriptorLike, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ...
|
||||
|
||||
@@ -3,7 +3,6 @@ from collections.abc import Awaitable, Callable, Coroutine
|
||||
from typing import Any, TypeVar, overload
|
||||
from typing_extensions import ParamSpec, TypeGuard, TypeIs
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = ("iscoroutinefunction", "iscoroutine")
|
||||
else:
|
||||
|
||||
@@ -22,7 +22,6 @@ from .tasks import Task
|
||||
from .transports import BaseTransport, DatagramTransport, ReadTransport, SubprocessTransport, Transport, WriteTransport
|
||||
from .unix_events import AbstractChildWatcher
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = (
|
||||
"AbstractEventLoopPolicy",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = (
|
||||
"BrokenBarrierError",
|
||||
|
||||
@@ -5,7 +5,6 @@ from typing_extensions import TypeIs
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("Future", "wrap_future", "isfuture")
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -15,7 +15,6 @@ if sys.version_info >= (3, 10):
|
||||
else:
|
||||
_LoopBoundMixin = object
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = ("Lock", "Event", "Condition", "Semaphore", "BoundedSemaphore", "Barrier")
|
||||
else:
|
||||
|
||||
@@ -2,7 +2,6 @@ from _typeshed import ReadableBuffer
|
||||
from asyncio import transports
|
||||
from typing import Any
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("BaseProtocol", "Protocol", "DatagramProtocol", "SubprocessProtocol", "BufferedProtocol")
|
||||
|
||||
class BaseProtocol:
|
||||
|
||||
@@ -13,7 +13,6 @@ else:
|
||||
class QueueEmpty(Exception): ...
|
||||
class QueueFull(Exception): ...
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 13):
|
||||
__all__ = ("Queue", "PriorityQueue", "LifoQueue", "QueueFull", "QueueEmpty", "QueueShutDown")
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ from typing_extensions import Self
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = ("Runner", "run")
|
||||
else:
|
||||
|
||||
@@ -9,7 +9,6 @@ from typing_extensions import Self, TypeAlias
|
||||
from . import events, protocols, transports
|
||||
from .base_events import Server
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.platform == "win32":
|
||||
__all__ = ("StreamReader", "StreamWriter", "StreamReaderProtocol", "open_connection", "start_server")
|
||||
else:
|
||||
|
||||
@@ -5,7 +5,6 @@ from asyncio import events, protocols, streams, transports
|
||||
from collections.abc import Callable, Collection
|
||||
from typing import IO, Any, Literal
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("create_subprocess_exec", "create_subprocess_shell")
|
||||
|
||||
PIPE: int
|
||||
|
||||
@@ -8,7 +8,6 @@ from . import _CoroutineLike
|
||||
from .events import AbstractEventLoop
|
||||
from .tasks import Task
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 12):
|
||||
__all__ = ("TaskGroup",)
|
||||
else:
|
||||
|
||||
@@ -18,7 +18,6 @@ from .futures import Future
|
||||
if sys.version_info >= (3, 11):
|
||||
from contextvars import Context
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 12):
|
||||
__all__ = (
|
||||
"Task",
|
||||
|
||||
@@ -2,7 +2,6 @@ from collections.abc import Callable
|
||||
from typing import TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("to_thread",)
|
||||
_P = ParamSpec("_P")
|
||||
_R = TypeVar("_R")
|
||||
|
||||
@@ -2,7 +2,6 @@ from types import TracebackType
|
||||
from typing import final
|
||||
from typing_extensions import Self
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("Timeout", "timeout", "timeout_at")
|
||||
|
||||
@final
|
||||
|
||||
@@ -4,7 +4,6 @@ from collections.abc import Iterable, Mapping
|
||||
from socket import _Address
|
||||
from typing import Any
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("BaseTransport", "ReadTransport", "WriteTransport", "Transport", "DatagramTransport", "SubprocessTransport")
|
||||
|
||||
class BaseTransport:
|
||||
|
||||
@@ -13,12 +13,10 @@ from .selector_events import BaseSelectorEventLoop
|
||||
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.platform != "win32":
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = ("SelectorEventLoop", "DefaultEventLoopPolicy", "EventLoop")
|
||||
elif sys.version_info >= (3, 13):
|
||||
# Adds EventLoop
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
"AbstractChildWatcher",
|
||||
@@ -31,7 +29,6 @@ if sys.platform != "win32":
|
||||
"EventLoop",
|
||||
)
|
||||
elif sys.version_info >= (3, 9):
|
||||
# adds PidfdChildWatcher
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
"AbstractChildWatcher",
|
||||
|
||||
@@ -6,7 +6,6 @@ from typing import IO, Any, ClassVar, Final, NoReturn
|
||||
|
||||
from . import events, futures, proactor_events, selector_events, streams, windows_utils
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.platform == "win32":
|
||||
if sys.version_info >= (3, 13):
|
||||
# 3.13 added `EventLoop`.
|
||||
|
||||
@@ -1489,18 +1489,18 @@ def locals() -> dict[str, Any]: ...
|
||||
|
||||
class map(Generic[_S]):
|
||||
@overload
|
||||
def __new__(cls, func: Callable[[_T1], _S], iterable: Iterable[_T1], /) -> Self: ...
|
||||
def __new__(cls, func: Callable[[_T1], _S], iter1: Iterable[_T1], /) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, func: Callable[[_T1, _T2], _S], iterable: Iterable[_T1], iter2: Iterable[_T2], /) -> Self: ...
|
||||
def __new__(cls, func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], /) -> Self: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls, func: Callable[[_T1, _T2, _T3], _S], iterable: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /
|
||||
cls, func: Callable[[_T1, _T2, _T3], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /
|
||||
) -> Self: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls,
|
||||
func: Callable[[_T1, _T2, _T3, _T4], _S],
|
||||
iterable: Iterable[_T1],
|
||||
iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4],
|
||||
@@ -1510,7 +1510,7 @@ class map(Generic[_S]):
|
||||
def __new__(
|
||||
cls,
|
||||
func: Callable[[_T1, _T2, _T3, _T4, _T5], _S],
|
||||
iterable: Iterable[_T1],
|
||||
iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4],
|
||||
@@ -1521,7 +1521,7 @@ class map(Generic[_S]):
|
||||
def __new__(
|
||||
cls,
|
||||
func: Callable[..., _S],
|
||||
iterable: Iterable[Any],
|
||||
iter1: Iterable[Any],
|
||||
iter2: Iterable[Any],
|
||||
iter3: Iterable[Any],
|
||||
iter4: Iterable[Any],
|
||||
@@ -1964,7 +1964,9 @@ class NameError(Exception):
|
||||
|
||||
class ReferenceError(Exception): ...
|
||||
class RuntimeError(Exception): ...
|
||||
class StopAsyncIteration(Exception): ...
|
||||
|
||||
class StopAsyncIteration(Exception):
|
||||
value: Any
|
||||
|
||||
class SyntaxError(Exception):
|
||||
msg: str
|
||||
|
||||
@@ -254,8 +254,6 @@ class StreamReaderWriter(TextIO):
|
||||
def writable(self) -> bool: ...
|
||||
|
||||
class StreamRecoder(BinaryIO):
|
||||
data_encoding: str
|
||||
file_encoding: str
|
||||
def __init__(
|
||||
self,
|
||||
stream: _Stream,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _collections_abc import dict_items, dict_keys, dict_values
|
||||
from _typeshed import SupportsItems, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
|
||||
from typing import Any, ClassVar, Generic, NoReturn, SupportsIndex, TypeVar, final, overload
|
||||
from typing import Any, Generic, NoReturn, SupportsIndex, TypeVar, final, overload
|
||||
from typing_extensions import Self
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -119,7 +119,6 @@ class UserList(MutableSequence[_T]):
|
||||
def __init__(self, initlist: None = None) -> None: ...
|
||||
@overload
|
||||
def __init__(self, initlist: Iterable[_T]) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __lt__(self, other: list[_T] | UserList[_T]) -> bool: ...
|
||||
def __le__(self, other: list[_T] | UserList[_T]) -> bool: ...
|
||||
def __gt__(self, other: list[_T] | UserList[_T]) -> bool: ...
|
||||
@@ -255,7 +254,6 @@ class deque(MutableSequence[_T]):
|
||||
def rotate(self, n: int = 1, /) -> None: ...
|
||||
def __copy__(self) -> Self: ...
|
||||
def __len__(self) -> int: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
# These methods of deque don't take slices, unlike MutableSequence, hence the type: ignores
|
||||
def __getitem__(self, key: SupportsIndex, /) -> _T: ... # type: ignore[override]
|
||||
def __setitem__(self, key: SupportsIndex, value: _T, /) -> None: ... # type: ignore[override]
|
||||
|
||||
@@ -33,12 +33,8 @@ _T_co = TypeVar("_T_co", covariant=True)
|
||||
_T_io = TypeVar("_T_io", bound=IO[str] | None)
|
||||
_ExitT_co = TypeVar("_ExitT_co", covariant=True, bound=bool | None, default=bool | None)
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_G = TypeVar("_G", bound=Generator[Any, Any, Any] | AsyncGenerator[Any, Any], covariant=True)
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
_SendT_contra = TypeVar("_SendT_contra", contravariant=True, default=None)
|
||||
_ReturnT_co = TypeVar("_ReturnT_co", covariant=True, default=None)
|
||||
|
||||
_ExitFunc: TypeAlias = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], bool | None]
|
||||
_CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any, Any] | _ExitFunc)
|
||||
|
||||
@@ -68,19 +64,16 @@ class ContextDecorator:
|
||||
def _recreate_cm(self) -> Self: ...
|
||||
def __call__(self, func: _F) -> _F: ...
|
||||
|
||||
class _GeneratorContextManagerBase(Generic[_G]):
|
||||
# Ideally this would use ParamSpec, but that requires (*args, **kwargs), which this isn't. see #6676
|
||||
def __init__(self, func: Callable[..., _G], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
|
||||
gen: _G
|
||||
func: Callable[..., _G]
|
||||
class _GeneratorContextManagerBase: ...
|
||||
|
||||
class _GeneratorContextManager(_GeneratorContextManagerBase, AbstractContextManager[_T_co, bool | None], ContextDecorator):
|
||||
# __init__ and all instance attributes are actually inherited from _GeneratorContextManagerBase
|
||||
# adding them there is more trouble than it's worth to include in the stub; see #6676
|
||||
def __init__(self, func: Callable[..., Iterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
|
||||
gen: Generator[_T_co, Any, Any]
|
||||
func: Callable[..., Generator[_T_co, Any, Any]]
|
||||
args: tuple[Any, ...]
|
||||
kwds: dict[str, Any]
|
||||
|
||||
class _GeneratorContextManager(
|
||||
_GeneratorContextManagerBase[Generator[_T_co, _SendT_contra, _ReturnT_co]],
|
||||
AbstractContextManager[_T_co, bool | None],
|
||||
ContextDecorator,
|
||||
):
|
||||
if sys.version_info >= (3, 9):
|
||||
def __exit__(
|
||||
self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
@@ -100,18 +93,26 @@ if sys.version_info >= (3, 10):
|
||||
def __call__(self, func: _AF) -> _AF: ...
|
||||
|
||||
class _AsyncGeneratorContextManager(
|
||||
_GeneratorContextManagerBase[AsyncGenerator[_T_co, _SendT_contra]],
|
||||
AbstractAsyncContextManager[_T_co, bool | None],
|
||||
AsyncContextDecorator,
|
||||
_GeneratorContextManagerBase, AbstractAsyncContextManager[_T_co, bool | None], AsyncContextDecorator
|
||||
):
|
||||
# __init__ and these attributes are actually defined in the base class _GeneratorContextManagerBase,
|
||||
# adding them there is more trouble than it's worth to include in the stub (see #6676)
|
||||
def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
|
||||
gen: AsyncGenerator[_T_co, Any]
|
||||
func: Callable[..., AsyncGenerator[_T_co, Any]]
|
||||
args: tuple[Any, ...]
|
||||
kwds: dict[str, Any]
|
||||
async def __aexit__(
|
||||
self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
|
||||
else:
|
||||
class _AsyncGeneratorContextManager(
|
||||
_GeneratorContextManagerBase[AsyncGenerator[_T_co, _SendT_contra]], AbstractAsyncContextManager[_T_co, bool | None]
|
||||
):
|
||||
class _AsyncGeneratorContextManager(_GeneratorContextManagerBase, AbstractAsyncContextManager[_T_co, bool | None]):
|
||||
def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
|
||||
gen: AsyncGenerator[_T_co, Any]
|
||||
func: Callable[..., AsyncGenerator[_T_co, Any]]
|
||||
args: tuple[Any, ...]
|
||||
kwds: dict[str, Any]
|
||||
async def __aexit__(
|
||||
self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
|
||||
@@ -24,9 +24,8 @@ from _ctypes import (
|
||||
set_errno as set_errno,
|
||||
sizeof as sizeof,
|
||||
)
|
||||
from _typeshed import StrPath
|
||||
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
|
||||
from typing import Any, ClassVar, Generic, TypeVar, type_check_only
|
||||
from typing import Any, ClassVar, Generic, TypeVar
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
|
||||
if sys.platform == "win32":
|
||||
@@ -46,32 +45,15 @@ DEFAULT_MODE: int
|
||||
|
||||
class ArgumentError(Exception): ...
|
||||
|
||||
# defined within CDLL.__init__
|
||||
# Runtime name is ctypes.CDLL.__init__.<locals>._FuncPtr
|
||||
@type_check_only
|
||||
class _CDLLFuncPointer(_CFuncPtr):
|
||||
_flags_: ClassVar[int]
|
||||
_restype_: ClassVar[type[_CDataType]]
|
||||
|
||||
# Not a real class; _CDLLFuncPointer with a __name__ set on it.
|
||||
@type_check_only
|
||||
class _NamedFuncPointer(_CDLLFuncPointer):
|
||||
__name__: str
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
_NameTypes: TypeAlias = StrPath | None
|
||||
else:
|
||||
_NameTypes: TypeAlias = str | None
|
||||
|
||||
class CDLL:
|
||||
_func_flags_: ClassVar[int]
|
||||
_func_restype_: ClassVar[type[_CDataType]]
|
||||
_name: str
|
||||
_handle: int
|
||||
_FuncPtr: type[_CDLLFuncPointer]
|
||||
_FuncPtr: type[_FuncPointer]
|
||||
def __init__(
|
||||
self,
|
||||
name: _NameTypes,
|
||||
name: str | None,
|
||||
mode: int = ...,
|
||||
handle: int | None = None,
|
||||
use_errno: bool = False,
|
||||
@@ -102,36 +84,27 @@ if sys.platform == "win32":
|
||||
pydll: LibraryLoader[PyDLL]
|
||||
pythonapi: PyDLL
|
||||
|
||||
# Class definition within CFUNCTYPE / WINFUNCTYPE / PYFUNCTYPE
|
||||
# Names at runtime are
|
||||
# ctypes.CFUNCTYPE.<locals>.CFunctionType
|
||||
# ctypes.WINFUNCTYPE.<locals>.WinFunctionType
|
||||
# ctypes.PYFUNCTYPE.<locals>.CFunctionType
|
||||
@type_check_only
|
||||
class _CFunctionType(_CFuncPtr):
|
||||
_argtypes_: ClassVar[list[type[_CData | _CDataType]]]
|
||||
_restype_: ClassVar[type[_CData | _CDataType] | None]
|
||||
_flags_: ClassVar[int]
|
||||
class _FuncPointer(_CFuncPtr): ...
|
||||
|
||||
# Alias for either function pointer type
|
||||
_FuncPointer: TypeAlias = _CDLLFuncPointer | _CFunctionType # noqa: Y047 # not used here
|
||||
class _NamedFuncPointer(_FuncPointer):
|
||||
__name__: str
|
||||
|
||||
def CFUNCTYPE(
|
||||
restype: type[_CData | _CDataType] | None,
|
||||
*argtypes: type[_CData | _CDataType],
|
||||
use_errno: bool = False,
|
||||
use_last_error: bool = False,
|
||||
) -> type[_CFunctionType]: ...
|
||||
use_errno: bool = ...,
|
||||
use_last_error: bool = ...,
|
||||
) -> type[_FuncPointer]: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def WINFUNCTYPE(
|
||||
restype: type[_CData | _CDataType] | None,
|
||||
*argtypes: type[_CData | _CDataType],
|
||||
use_errno: bool = False,
|
||||
use_last_error: bool = False,
|
||||
) -> type[_CFunctionType]: ...
|
||||
use_errno: bool = ...,
|
||||
use_last_error: bool = ...,
|
||||
) -> type[_FuncPointer]: ...
|
||||
|
||||
def PYFUNCTYPE(restype: type[_CData | _CDataType] | None, *argtypes: type[_CData | _CDataType]) -> type[_CFunctionType]: ...
|
||||
def PYFUNCTYPE(restype: type[_CData | _CDataType] | None, *argtypes: type[_CData | _CDataType]) -> type[_FuncPointer]: ...
|
||||
|
||||
# Any type that can be implicitly converted to c_void_p when passed as a C function argument.
|
||||
# (bytes is not included here, see below.)
|
||||
@@ -161,22 +134,8 @@ if sys.platform == "win32":
|
||||
def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO not documented
|
||||
def GetLastError() -> int: ...
|
||||
|
||||
# Actually just an instance of _CFunctionType, but we want to set a more
|
||||
# specific __call__.
|
||||
@type_check_only
|
||||
class _MemmoveFunctionType(_CFunctionType):
|
||||
def __call__(self, dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> int: ...
|
||||
|
||||
memmove: _MemmoveFunctionType
|
||||
|
||||
# Actually just an instance of _CFunctionType, but we want to set a more
|
||||
# specific __call__.
|
||||
@type_check_only
|
||||
class _MemsetFunctionType(_CFunctionType):
|
||||
def __call__(self, dst: _CVoidPLike, c: int, count: int) -> int: ...
|
||||
|
||||
memset: _MemsetFunctionType
|
||||
|
||||
def memmove(dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> int: ...
|
||||
def memset(dst: _CVoidPLike, c: int, count: int) -> int: ...
|
||||
def string_at(ptr: _CVoidConstPLike, size: int = -1) -> bytes: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
|
||||
@@ -152,37 +152,33 @@ if sys.version_info >= (3, 10):
|
||||
def field(
|
||||
*,
|
||||
default: _T,
|
||||
default_factory: Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
hash: bool | None = None,
|
||||
compare: bool = True,
|
||||
metadata: Mapping[Any, Any] | None = None,
|
||||
kw_only: bool | Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
kw_only: bool = ...,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def field(
|
||||
*,
|
||||
default: Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
default_factory: Callable[[], _T],
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
hash: bool | None = None,
|
||||
compare: bool = True,
|
||||
metadata: Mapping[Any, Any] | None = None,
|
||||
kw_only: bool | Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
kw_only: bool = ...,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def field(
|
||||
*,
|
||||
default: Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
default_factory: Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
hash: bool | None = None,
|
||||
compare: bool = True,
|
||||
metadata: Mapping[Any, Any] | None = None,
|
||||
kw_only: bool | Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
kw_only: bool = ...,
|
||||
) -> Any: ...
|
||||
|
||||
else:
|
||||
@@ -190,7 +186,6 @@ else:
|
||||
def field(
|
||||
*,
|
||||
default: _T,
|
||||
default_factory: Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
hash: bool | None = None,
|
||||
@@ -200,7 +195,6 @@ else:
|
||||
@overload
|
||||
def field(
|
||||
*,
|
||||
default: Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
default_factory: Callable[[], _T],
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
@@ -211,8 +205,6 @@ else:
|
||||
@overload
|
||||
def field(
|
||||
*,
|
||||
default: Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
default_factory: Literal[_MISSING_TYPE.MISSING] = ...,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
hash: bool | None = None,
|
||||
|
||||
@@ -29,7 +29,7 @@ class timezone(tzinfo):
|
||||
utc: ClassVar[timezone]
|
||||
min: ClassVar[timezone]
|
||||
max: ClassVar[timezone]
|
||||
def __new__(cls, offset: timedelta, name: str = ...) -> Self: ...
|
||||
def __init__(self, offset: timedelta, name: str = ...) -> None: ...
|
||||
def tzname(self, dt: datetime | None, /) -> str: ...
|
||||
def utcoffset(self, dt: datetime | None, /) -> timedelta: ...
|
||||
def dst(self, dt: datetime | None, /) -> None: ...
|
||||
|
||||
@@ -189,6 +189,7 @@ class Context:
|
||||
clamp: int | None = ...,
|
||||
flags: None | dict[_TrapType, bool] | Container[_TrapType] = ...,
|
||||
traps: None | dict[_TrapType, bool] | Container[_TrapType] = ...,
|
||||
_ignored_flags: list[_TrapType] | None = ...,
|
||||
) -> None: ...
|
||||
def __reduce__(self) -> tuple[type[Self], tuple[Any, ...]]: ...
|
||||
def clear_flags(self) -> None: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from collections.abc import Callable, Iterator
|
||||
from email.message import Message
|
||||
from typing import ClassVar, Final, overload
|
||||
from typing import Final, overload
|
||||
|
||||
__all__ = ["Charset", "add_alias", "add_charset", "add_codec"]
|
||||
|
||||
@@ -24,7 +24,6 @@ class Charset:
|
||||
def body_encode(self, string: None) -> None: ...
|
||||
@overload
|
||||
def body_encode(self, string: str | bytes) -> str: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, value: object, /) -> bool: ...
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from collections.abc import Iterable
|
||||
from email.charset import Charset
|
||||
from typing import Any, ClassVar
|
||||
from typing import Any
|
||||
|
||||
__all__ = ["Header", "decode_header", "make_header"]
|
||||
|
||||
@@ -16,7 +16,6 @@ class Header:
|
||||
) -> None: ...
|
||||
def append(self, s: bytes | bytearray | str, charset: Charset | str | None = None, errors: str = "strict") -> None: ...
|
||||
def encode(self, splitchars: str = ";, \t", maxlinelen: int | None = None, linesep: str = "\n") -> str: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, value: object, /) -> bool: ...
|
||||
|
||||
|
||||
@@ -167,7 +167,6 @@ class Address:
|
||||
def __init__(
|
||||
self, display_name: str = "", username: str | None = "", domain: str | None = "", addr_spec: str | None = None
|
||||
) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
class Group:
|
||||
@@ -176,5 +175,4 @@ class Group:
|
||||
@property
|
||||
def addresses(self) -> tuple[Address, ...]: ...
|
||||
def __init__(self, display_name: str | None = None, addresses: Iterable[Address] | None = None) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
@@ -138,7 +138,7 @@ class Fraction(Rational):
|
||||
def __round__(self, ndigits: None = None) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: int) -> Fraction: ...
|
||||
def __hash__(self) -> int: ... # type: ignore[override]
|
||||
def __hash__(self) -> int: ...
|
||||
def __eq__(a, b: object) -> bool: ...
|
||||
def __lt__(a, b: _ComparableNum) -> bool: ...
|
||||
def __gt__(a, b: _ComparableNum) -> bool: ...
|
||||
|
||||
@@ -14,14 +14,9 @@ class HTTPStatus(IntEnum):
|
||||
def phrase(self) -> str: ...
|
||||
@property
|
||||
def description(self) -> str: ...
|
||||
|
||||
# Keep these synced with the global constants in http/client.pyi.
|
||||
CONTINUE = 100
|
||||
SWITCHING_PROTOCOLS = 101
|
||||
PROCESSING = 102
|
||||
if sys.version_info >= (3, 9):
|
||||
EARLY_HINTS = 103
|
||||
|
||||
OK = 200
|
||||
CREATED = 201
|
||||
ACCEPTED = 202
|
||||
@@ -32,7 +27,6 @@ class HTTPStatus(IntEnum):
|
||||
MULTI_STATUS = 207
|
||||
ALREADY_REPORTED = 208
|
||||
IM_USED = 226
|
||||
|
||||
MULTIPLE_CHOICES = 300
|
||||
MOVED_PERMANENTLY = 301
|
||||
FOUND = 302
|
||||
@@ -41,7 +35,6 @@ class HTTPStatus(IntEnum):
|
||||
USE_PROXY = 305
|
||||
TEMPORARY_REDIRECT = 307
|
||||
PERMANENT_REDIRECT = 308
|
||||
|
||||
BAD_REQUEST = 400
|
||||
UNAUTHORIZED = 401
|
||||
PAYMENT_REQUIRED = 402
|
||||
@@ -66,22 +59,15 @@ class HTTPStatus(IntEnum):
|
||||
RANGE_NOT_SATISFIABLE = 416
|
||||
REQUESTED_RANGE_NOT_SATISFIABLE = 416
|
||||
EXPECTATION_FAILED = 417
|
||||
if sys.version_info >= (3, 9):
|
||||
IM_A_TEAPOT = 418
|
||||
MISDIRECTED_REQUEST = 421
|
||||
if sys.version_info >= (3, 13):
|
||||
UNPROCESSABLE_CONTENT = 422
|
||||
UNPROCESSABLE_ENTITY = 422
|
||||
LOCKED = 423
|
||||
FAILED_DEPENDENCY = 424
|
||||
if sys.version_info >= (3, 9):
|
||||
TOO_EARLY = 425
|
||||
UPGRADE_REQUIRED = 426
|
||||
PRECONDITION_REQUIRED = 428
|
||||
TOO_MANY_REQUESTS = 429
|
||||
REQUEST_HEADER_FIELDS_TOO_LARGE = 431
|
||||
UNAVAILABLE_FOR_LEGAL_REASONS = 451
|
||||
|
||||
INTERNAL_SERVER_ERROR = 500
|
||||
NOT_IMPLEMENTED = 501
|
||||
BAD_GATEWAY = 502
|
||||
@@ -93,7 +79,12 @@ class HTTPStatus(IntEnum):
|
||||
LOOP_DETECTED = 508
|
||||
NOT_EXTENDED = 510
|
||||
NETWORK_AUTHENTICATION_REQUIRED = 511
|
||||
|
||||
MISDIRECTED_REQUEST = 421
|
||||
UNAVAILABLE_FOR_LEGAL_REASONS = 451
|
||||
if sys.version_info >= (3, 9):
|
||||
EARLY_HINTS = 103
|
||||
IM_A_TEAPOT = 418
|
||||
TOO_EARLY = 425
|
||||
if sys.version_info >= (3, 12):
|
||||
@property
|
||||
def is_informational(self) -> bool: ...
|
||||
|
||||
@@ -6,7 +6,7 @@ import types
|
||||
from _typeshed import MaybeNone, ReadableBuffer, SupportsRead, SupportsReadline, WriteableBuffer
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||
from socket import socket
|
||||
from typing import BinaryIO, Literal, TypeVar, overload
|
||||
from typing import BinaryIO, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
__all__ = [
|
||||
@@ -39,85 +39,63 @@ _HeaderValue: TypeAlias = ReadableBuffer | str | int
|
||||
HTTP_PORT: int
|
||||
HTTPS_PORT: int
|
||||
|
||||
# Keep these global constants in sync with http.HTTPStatus (http/__init__.pyi).
|
||||
# They are present for backward compatibility reasons.
|
||||
CONTINUE: Literal[100]
|
||||
SWITCHING_PROTOCOLS: Literal[101]
|
||||
PROCESSING: Literal[102]
|
||||
if sys.version_info >= (3, 9):
|
||||
EARLY_HINTS: Literal[103]
|
||||
CONTINUE: int
|
||||
SWITCHING_PROTOCOLS: int
|
||||
PROCESSING: int
|
||||
|
||||
OK: Literal[200]
|
||||
CREATED: Literal[201]
|
||||
ACCEPTED: Literal[202]
|
||||
NON_AUTHORITATIVE_INFORMATION: Literal[203]
|
||||
NO_CONTENT: Literal[204]
|
||||
RESET_CONTENT: Literal[205]
|
||||
PARTIAL_CONTENT: Literal[206]
|
||||
MULTI_STATUS: Literal[207]
|
||||
ALREADY_REPORTED: Literal[208]
|
||||
IM_USED: Literal[226]
|
||||
OK: int
|
||||
CREATED: int
|
||||
ACCEPTED: int
|
||||
NON_AUTHORITATIVE_INFORMATION: int
|
||||
NO_CONTENT: int
|
||||
RESET_CONTENT: int
|
||||
PARTIAL_CONTENT: int
|
||||
MULTI_STATUS: int
|
||||
IM_USED: int
|
||||
|
||||
MULTIPLE_CHOICES: Literal[300]
|
||||
MOVED_PERMANENTLY: Literal[301]
|
||||
FOUND: Literal[302]
|
||||
SEE_OTHER: Literal[303]
|
||||
NOT_MODIFIED: Literal[304]
|
||||
USE_PROXY: Literal[305]
|
||||
TEMPORARY_REDIRECT: Literal[307]
|
||||
PERMANENT_REDIRECT: Literal[308]
|
||||
MULTIPLE_CHOICES: int
|
||||
MOVED_PERMANENTLY: int
|
||||
FOUND: int
|
||||
SEE_OTHER: int
|
||||
NOT_MODIFIED: int
|
||||
USE_PROXY: int
|
||||
TEMPORARY_REDIRECT: int
|
||||
|
||||
BAD_REQUEST: Literal[400]
|
||||
UNAUTHORIZED: Literal[401]
|
||||
PAYMENT_REQUIRED: Literal[402]
|
||||
FORBIDDEN: Literal[403]
|
||||
NOT_FOUND: Literal[404]
|
||||
METHOD_NOT_ALLOWED: Literal[405]
|
||||
NOT_ACCEPTABLE: Literal[406]
|
||||
PROXY_AUTHENTICATION_REQUIRED: Literal[407]
|
||||
REQUEST_TIMEOUT: Literal[408]
|
||||
CONFLICT: Literal[409]
|
||||
GONE: Literal[410]
|
||||
LENGTH_REQUIRED: Literal[411]
|
||||
PRECONDITION_FAILED: Literal[412]
|
||||
if sys.version_info >= (3, 13):
|
||||
CONTENT_TOO_LARGE: Literal[413]
|
||||
REQUEST_ENTITY_TOO_LARGE: Literal[413]
|
||||
if sys.version_info >= (3, 13):
|
||||
URI_TOO_LONG: Literal[414]
|
||||
REQUEST_URI_TOO_LONG: Literal[414]
|
||||
UNSUPPORTED_MEDIA_TYPE: Literal[415]
|
||||
if sys.version_info >= (3, 13):
|
||||
RANGE_NOT_SATISFIABLE: Literal[416]
|
||||
REQUESTED_RANGE_NOT_SATISFIABLE: Literal[416]
|
||||
EXPECTATION_FAILED: Literal[417]
|
||||
if sys.version_info >= (3, 9):
|
||||
IM_A_TEAPOT: Literal[418]
|
||||
MISDIRECTED_REQUEST: Literal[421]
|
||||
if sys.version_info >= (3, 13):
|
||||
UNPROCESSABLE_CONTENT: Literal[422]
|
||||
UNPROCESSABLE_ENTITY: Literal[422]
|
||||
LOCKED: Literal[423]
|
||||
FAILED_DEPENDENCY: Literal[424]
|
||||
if sys.version_info >= (3, 9):
|
||||
TOO_EARLY: Literal[425]
|
||||
UPGRADE_REQUIRED: Literal[426]
|
||||
PRECONDITION_REQUIRED: Literal[428]
|
||||
TOO_MANY_REQUESTS: Literal[429]
|
||||
REQUEST_HEADER_FIELDS_TOO_LARGE: Literal[431]
|
||||
UNAVAILABLE_FOR_LEGAL_REASONS: Literal[451]
|
||||
BAD_REQUEST: int
|
||||
UNAUTHORIZED: int
|
||||
PAYMENT_REQUIRED: int
|
||||
FORBIDDEN: int
|
||||
NOT_FOUND: int
|
||||
METHOD_NOT_ALLOWED: int
|
||||
NOT_ACCEPTABLE: int
|
||||
PROXY_AUTHENTICATION_REQUIRED: int
|
||||
REQUEST_TIMEOUT: int
|
||||
CONFLICT: int
|
||||
GONE: int
|
||||
LENGTH_REQUIRED: int
|
||||
PRECONDITION_FAILED: int
|
||||
REQUEST_ENTITY_TOO_LARGE: int
|
||||
REQUEST_URI_TOO_LONG: int
|
||||
UNSUPPORTED_MEDIA_TYPE: int
|
||||
REQUESTED_RANGE_NOT_SATISFIABLE: int
|
||||
EXPECTATION_FAILED: int
|
||||
UNPROCESSABLE_ENTITY: int
|
||||
LOCKED: int
|
||||
FAILED_DEPENDENCY: int
|
||||
UPGRADE_REQUIRED: int
|
||||
PRECONDITION_REQUIRED: int
|
||||
TOO_MANY_REQUESTS: int
|
||||
REQUEST_HEADER_FIELDS_TOO_LARGE: int
|
||||
|
||||
INTERNAL_SERVER_ERROR: Literal[500]
|
||||
NOT_IMPLEMENTED: Literal[501]
|
||||
BAD_GATEWAY: Literal[502]
|
||||
SERVICE_UNAVAILABLE: Literal[503]
|
||||
GATEWAY_TIMEOUT: Literal[504]
|
||||
HTTP_VERSION_NOT_SUPPORTED: Literal[505]
|
||||
VARIANT_ALSO_NEGOTIATES: Literal[506]
|
||||
INSUFFICIENT_STORAGE: Literal[507]
|
||||
LOOP_DETECTED: Literal[508]
|
||||
NOT_EXTENDED: Literal[510]
|
||||
NETWORK_AUTHENTICATION_REQUIRED: Literal[511]
|
||||
INTERNAL_SERVER_ERROR: int
|
||||
NOT_IMPLEMENTED: int
|
||||
BAD_GATEWAY: int
|
||||
SERVICE_UNAVAILABLE: int
|
||||
GATEWAY_TIMEOUT: int
|
||||
HTTP_VERSION_NOT_SUPPORTED: int
|
||||
INSUFFICIENT_STORAGE: int
|
||||
NOT_EXTENDED: int
|
||||
NETWORK_AUTHENTICATION_REQUIRED: int
|
||||
|
||||
responses: dict[int, str]
|
||||
|
||||
|
||||
@@ -416,16 +416,16 @@ class BoundArguments:
|
||||
def __init__(self, signature: Signature, arguments: OrderedDict[str, Any]) -> None: ...
|
||||
def apply_defaults(self) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
#
|
||||
# Classes and functions
|
||||
#
|
||||
|
||||
_ClassTreeItem: TypeAlias = list[tuple[type, ...]] | list[_ClassTreeItem]
|
||||
|
||||
def getclasstree(classes: list[type], unique: bool = False) -> _ClassTreeItem: ...
|
||||
def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> _ClassTreeItem: ...
|
||||
# TODO: The actual return type should be list[_ClassTreeItem] but mypy doesn't
|
||||
# seem to be supporting this at the moment:
|
||||
# _ClassTreeItem = list[_ClassTreeItem] | Tuple[type, Tuple[type, ...]]
|
||||
def getclasstree(classes: list[type], unique: bool = False) -> list[Any]: ...
|
||||
def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> list[Any]: ...
|
||||
|
||||
class Arguments(NamedTuple):
|
||||
args: list[str]
|
||||
|
||||
@@ -32,6 +32,7 @@ class _IPAddressBase:
|
||||
def version(self) -> int: ...
|
||||
|
||||
class _BaseAddress(_IPAddressBase):
|
||||
def __init__(self, address: object) -> None: ...
|
||||
def __add__(self, other: int) -> Self: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __int__(self) -> int: ...
|
||||
@@ -53,6 +54,7 @@ class _BaseAddress(_IPAddressBase):
|
||||
class _BaseNetwork(_IPAddressBase, Generic[_A]):
|
||||
network_address: _A
|
||||
netmask: _A
|
||||
def __init__(self, address: object, strict: bool = ...) -> None: ...
|
||||
def __contains__(self, other: Any) -> bool: ...
|
||||
def __getitem__(self, n: int) -> _A: ...
|
||||
def __iter__(self) -> Iterator[_A]: ...
|
||||
@@ -112,7 +114,6 @@ class _BaseV4:
|
||||
def max_prefixlen(self) -> Literal[32]: ...
|
||||
|
||||
class IPv4Address(_BaseV4, _BaseAddress):
|
||||
def __init__(self, address: object) -> None: ...
|
||||
@property
|
||||
def is_global(self) -> bool: ...
|
||||
@property
|
||||
@@ -133,8 +134,7 @@ class IPv4Address(_BaseV4, _BaseAddress):
|
||||
@property
|
||||
def ipv6_mapped(self) -> IPv6Address: ...
|
||||
|
||||
class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]):
|
||||
def __init__(self, address: object, strict: bool = ...) -> None: ...
|
||||
class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]): ...
|
||||
|
||||
class IPv4Interface(IPv4Address):
|
||||
netmask: IPv4Address
|
||||
@@ -159,7 +159,6 @@ class _BaseV6:
|
||||
def max_prefixlen(self) -> Literal[128]: ...
|
||||
|
||||
class IPv6Address(_BaseV6, _BaseAddress):
|
||||
def __init__(self, address: object) -> None: ...
|
||||
@property
|
||||
def is_global(self) -> bool: ...
|
||||
@property
|
||||
@@ -192,7 +191,6 @@ class IPv6Address(_BaseV6, _BaseAddress):
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
class IPv6Network(_BaseV6, _BaseNetwork[IPv6Address]):
|
||||
def __init__(self, address: object, strict: bool = ...) -> None: ...
|
||||
@property
|
||||
def is_site_local(self) -> bool: ...
|
||||
|
||||
|
||||
@@ -40,29 +40,29 @@ class count(Generic[_N]):
|
||||
def __iter__(self) -> Self: ...
|
||||
|
||||
class cycle(Generic[_T]):
|
||||
def __new__(cls, iterable: Iterable[_T], /) -> Self: ...
|
||||
def __init__(self, iterable: Iterable[_T], /) -> None: ...
|
||||
def __next__(self) -> _T: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
|
||||
class repeat(Generic[_T]):
|
||||
@overload
|
||||
def __new__(cls, object: _T) -> Self: ...
|
||||
def __init__(self, object: _T) -> None: ...
|
||||
@overload
|
||||
def __new__(cls, object: _T, times: int) -> Self: ...
|
||||
def __init__(self, object: _T, times: int) -> None: ...
|
||||
def __next__(self) -> _T: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __length_hint__(self) -> int: ...
|
||||
|
||||
class accumulate(Generic[_T]):
|
||||
@overload
|
||||
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> Self: ...
|
||||
def __init__(self, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> None: ...
|
||||
@overload
|
||||
def __new__(cls, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> Self: ...
|
||||
def __init__(self, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class chain(Generic[_T]):
|
||||
def __new__(cls, *iterables: Iterable[_T]) -> Self: ...
|
||||
def __init__(self, *iterables: Iterable[_T]) -> None: ...
|
||||
def __next__(self) -> _T: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
@classmethod
|
||||
@@ -72,17 +72,17 @@ class chain(Generic[_T]):
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
class compress(Generic[_T]):
|
||||
def __new__(cls, data: Iterable[_T], selectors: Iterable[Any]) -> Self: ...
|
||||
def __init__(self, data: Iterable[_T], selectors: Iterable[Any]) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class dropwhile(Generic[_T]):
|
||||
def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ...
|
||||
def __init__(self, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class filterfalse(Generic[_T]):
|
||||
def __new__(cls, function: _Predicate[_T] | None, iterable: Iterable[_T], /) -> Self: ...
|
||||
def __init__(self, predicate: _Predicate[_T] | None, iterable: Iterable[_T], /) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
@@ -96,9 +96,9 @@ class groupby(Generic[_T_co, _S_co]):
|
||||
|
||||
class islice(Generic[_T]):
|
||||
@overload
|
||||
def __new__(cls, iterable: Iterable[_T], stop: int | None, /) -> Self: ...
|
||||
def __init__(self, iterable: Iterable[_T], stop: int | None, /) -> None: ...
|
||||
@overload
|
||||
def __new__(cls, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = ..., /) -> Self: ...
|
||||
def __init__(self, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = ..., /) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
@@ -108,7 +108,7 @@ class starmap(Generic[_T_co]):
|
||||
def __next__(self) -> _T_co: ...
|
||||
|
||||
class takewhile(Generic[_T]):
|
||||
def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ...
|
||||
def __init__(self, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Incomplete, StrPath
|
||||
from collections.abc import Iterable, Iterator
|
||||
from typing import IO, ClassVar, NoReturn, overload
|
||||
from typing import IO, NoReturn, overload
|
||||
|
||||
from . import grammar
|
||||
from .tokenize import _TokenInfo
|
||||
@@ -46,6 +46,5 @@ class DFAState:
|
||||
def addarc(self, next: DFAState, label: str) -> None: ...
|
||||
def unifystate(self, old: DFAState, new: DFAState) -> None: ...
|
||||
def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override]
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
def generate_grammar(filename: StrPath = "Grammar.txt") -> PgenGrammar: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from _typeshed import Incomplete, SupportsGetItem, SupportsLenAndGetItem, Unused
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Iterable, Iterator, MutableSequence
|
||||
from typing import ClassVar, Final
|
||||
from typing import Final
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
from .fixer_base import BaseFix
|
||||
@@ -24,7 +24,6 @@ class Base:
|
||||
was_changed: bool
|
||||
was_checked: bool
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
@abstractmethod
|
||||
def _eq(self, other: Base) -> bool: ...
|
||||
@abstractmethod
|
||||
|
||||
@@ -35,8 +35,8 @@ class mmap:
|
||||
def __init__(self, fileno: int, length: int, tagname: str | None = ..., access: int = ..., offset: int = ...) -> None: ...
|
||||
else:
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
fileno: int,
|
||||
length: int,
|
||||
flags: int = ...,
|
||||
@@ -45,11 +45,11 @@ class mmap:
|
||||
offset: int = ...,
|
||||
*,
|
||||
trackfd: bool = True,
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __new__(
|
||||
cls, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ...
|
||||
) -> Self: ...
|
||||
def __init__(
|
||||
self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ...
|
||||
) -> None: ...
|
||||
|
||||
def close(self) -> None: ...
|
||||
def flush(self, offset: int = ..., size: int = ...) -> None: ...
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import queue
|
||||
import sys
|
||||
import threading
|
||||
from _typeshed import SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
|
||||
from _typeshed import Incomplete, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Sequence
|
||||
from types import TracebackType
|
||||
from typing import Any, AnyStr, ClassVar, Generic, SupportsIndex, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
from . import pool
|
||||
from .connection import Connection, _Address
|
||||
from .connection import Connection
|
||||
from .context import BaseContext
|
||||
from .shared_memory import _SLT, ShareableList as _ShareableList, SharedMemory as _SharedMemory
|
||||
from .util import Finalize as _Finalize
|
||||
@@ -31,14 +30,14 @@ _Namespace: TypeAlias = Namespace
|
||||
|
||||
class Token:
|
||||
typeid: str | bytes | None
|
||||
address: _Address | None
|
||||
address: tuple[str | bytes, int]
|
||||
id: str | bytes | int | None
|
||||
def __init__(self, typeid: bytes | str | None, address: _Address | None, id: str | bytes | int | None) -> None: ...
|
||||
def __init__(self, typeid: bytes | str | None, address: tuple[str | bytes, int], id: str | bytes | int | None) -> None: ...
|
||||
def __getstate__(self) -> tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]: ...
|
||||
def __setstate__(self, state: tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]) -> None: ...
|
||||
|
||||
class BaseProxy:
|
||||
_address_to_local: dict[_Address, Any]
|
||||
_address_to_local: dict[Any, Any]
|
||||
_mutex: Any
|
||||
def __init__(
|
||||
self,
|
||||
@@ -130,7 +129,6 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]):
|
||||
def __setitem__(self, s: slice, o: Iterable[_T], /) -> None: ...
|
||||
def __mul__(self, n: SupportsIndex, /) -> list[_T]: ...
|
||||
def __rmul__(self, n: SupportsIndex, /) -> list[_T]: ...
|
||||
def __imul__(self, value: SupportsIndex, /) -> Self: ...
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
def append(self, object: _T, /) -> None: ...
|
||||
def extend(self, iterable: Iterable[_T], /) -> None: ...
|
||||
@@ -152,50 +150,22 @@ class ListProxy(BaseListProxy[_T]):
|
||||
if sys.version_info >= (3, 13):
|
||||
def __class_getitem__(cls, args: Any, /) -> Any: ...
|
||||
|
||||
# Send is (kind, result)
|
||||
# Receive is (id, methodname, args, kwds)
|
||||
_ServerConnection: TypeAlias = Connection[tuple[str, Any], tuple[str, str, Iterable[Any], Mapping[str, Any]]]
|
||||
|
||||
# Returned by BaseManager.get_server()
|
||||
class Server:
|
||||
address: _Address | None
|
||||
id_to_obj: dict[str, tuple[Any, set[str], dict[str, str]]]
|
||||
fallback_mapping: dict[str, Callable[[_ServerConnection, str, Any], Any]]
|
||||
public: list[str]
|
||||
# Registry values are (callable, exposed, method_to_typeid, proxytype)
|
||||
address: Any
|
||||
def __init__(
|
||||
self,
|
||||
registry: dict[str, tuple[Callable[..., Any], Iterable[str], dict[str, str], Any]],
|
||||
address: _Address | None,
|
||||
authkey: bytes,
|
||||
serializer: str,
|
||||
self, registry: dict[str, tuple[Callable[..., Any], Any, Any, Any]], address: Any, authkey: bytes, serializer: str
|
||||
) -> None: ...
|
||||
def serve_forever(self) -> None: ...
|
||||
def accepter(self) -> None: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
def handle_request(self, conn: _ServerConnection) -> None: ...
|
||||
else:
|
||||
def handle_request(self, c: _ServerConnection) -> None: ...
|
||||
|
||||
def serve_client(self, conn: _ServerConnection) -> None: ...
|
||||
def fallback_getvalue(self, conn: _ServerConnection, ident: str, obj: _T) -> _T: ...
|
||||
def fallback_str(self, conn: _ServerConnection, ident: str, obj: Any) -> str: ...
|
||||
def fallback_repr(self, conn: _ServerConnection, ident: str, obj: Any) -> str: ...
|
||||
def dummy(self, c: _ServerConnection) -> None: ...
|
||||
def debug_info(self, c: _ServerConnection) -> str: ...
|
||||
def number_of_objects(self, c: _ServerConnection) -> int: ...
|
||||
def shutdown(self, c: _ServerConnection) -> None: ...
|
||||
def create(self, c: _ServerConnection, typeid: str, /, *args: Any, **kwds: Any) -> tuple[str, tuple[str, ...]]: ...
|
||||
def get_methods(self, c: _ServerConnection, token: Token) -> set[str]: ...
|
||||
def accept_connection(self, c: _ServerConnection, name: str) -> None: ...
|
||||
def incref(self, c: _ServerConnection, ident: str) -> None: ...
|
||||
def decref(self, c: _ServerConnection, ident: str) -> None: ...
|
||||
def accept_connection(
|
||||
self, c: Connection[tuple[str, str | None], tuple[str, str, Iterable[Incomplete], Mapping[str, Incomplete]]], name: str
|
||||
) -> None: ...
|
||||
|
||||
class BaseManager:
|
||||
if sys.version_info >= (3, 11):
|
||||
def __init__(
|
||||
self,
|
||||
address: _Address | None = None,
|
||||
address: Any | None = None,
|
||||
authkey: bytes | None = None,
|
||||
serializer: str = "pickle",
|
||||
ctx: BaseContext | None = None,
|
||||
@@ -205,7 +175,7 @@ class BaseManager:
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
address: _Address | None = None,
|
||||
address: Any | None = None,
|
||||
authkey: bytes | None = None,
|
||||
serializer: str = "pickle",
|
||||
ctx: BaseContext | None = None,
|
||||
@@ -217,7 +187,7 @@ class BaseManager:
|
||||
shutdown: _Finalize # only available after start() was called
|
||||
def join(self, timeout: float | None = None) -> None: ... # undocumented
|
||||
@property
|
||||
def address(self) -> _Address | None: ...
|
||||
def address(self) -> Any: ...
|
||||
@classmethod
|
||||
def register(
|
||||
cls,
|
||||
@@ -234,26 +204,14 @@ class BaseManager:
|
||||
) -> None: ...
|
||||
|
||||
class SyncManager(BaseManager):
|
||||
def Barrier(
|
||||
self, parties: int, action: Callable[[], None] | None = None, timeout: float | None = None
|
||||
) -> threading.Barrier: ...
|
||||
def BoundedSemaphore(self, value: int = 1) -> threading.BoundedSemaphore: ...
|
||||
def Condition(self, lock: threading.Lock | threading._RLock | None = None) -> threading.Condition: ...
|
||||
def BoundedSemaphore(self, value: Any = ...) -> threading.BoundedSemaphore: ...
|
||||
def Condition(self, lock: Any = ...) -> threading.Condition: ...
|
||||
def Event(self) -> threading.Event: ...
|
||||
def Lock(self) -> threading.Lock: ...
|
||||
def Namespace(self) -> _Namespace: ...
|
||||
def Pool(
|
||||
self,
|
||||
processes: int | None = None,
|
||||
initializer: Callable[..., object] | None = None,
|
||||
initargs: Iterable[Any] = (),
|
||||
maxtasksperchild: int | None = None,
|
||||
context: Any | None = None,
|
||||
) -> pool.Pool: ...
|
||||
def Queue(self, maxsize: int = ...) -> queue.Queue[Any]: ...
|
||||
def JoinableQueue(self, maxsize: int = ...) -> queue.Queue[Any]: ...
|
||||
def RLock(self) -> threading.RLock: ...
|
||||
def Semaphore(self, value: int = 1) -> threading.Semaphore: ...
|
||||
def Semaphore(self, value: Any = ...) -> threading.Semaphore: ...
|
||||
def Array(self, typecode: Any, sequence: Sequence[_T]) -> Sequence[_T]: ...
|
||||
def Value(self, typecode: Any, value: _T) -> ValueProxy[_T]: ...
|
||||
# Overloads are copied from builtins.dict.__init__
|
||||
@@ -279,11 +237,7 @@ class SyncManager(BaseManager):
|
||||
def list(self) -> ListProxy[Any]: ...
|
||||
|
||||
class RemoteError(Exception): ...
|
||||
|
||||
class SharedMemoryServer(Server):
|
||||
def track_segment(self, c: _ServerConnection, segment_name: str) -> None: ...
|
||||
def release_segment(self, c: _ServerConnection, segment_name: str) -> None: ...
|
||||
def list_segments(self, c: _ServerConnection) -> list[str]: ...
|
||||
class SharedMemoryServer(Server): ...
|
||||
|
||||
class SharedMemoryManager(BaseManager):
|
||||
def get_server(self) -> SharedMemoryServer: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
from collections.abc import Callable, Iterable, Mapping
|
||||
from multiprocessing.context import DefaultContext, Process
|
||||
from types import TracebackType
|
||||
from typing import Any, Final, Generic, TypeVar
|
||||
from typing_extensions import Self
|
||||
@@ -54,8 +53,6 @@ class Pool:
|
||||
maxtasksperchild: int | None = None,
|
||||
context: Any | None = None,
|
||||
) -> None: ...
|
||||
@staticmethod
|
||||
def Process(ctx: DefaultContext, *args: Any, **kwds: Any) -> Process: ...
|
||||
def apply(self, func: Callable[..., _T], args: Iterable[Any] = (), kwds: Mapping[str, Any] = {}) -> _T: ...
|
||||
def apply_async(
|
||||
self,
|
||||
|
||||
@@ -54,7 +54,6 @@ class RLock(SemLock):
|
||||
|
||||
class Semaphore(SemLock):
|
||||
def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ...
|
||||
def get_value(self) -> int: ...
|
||||
|
||||
class BoundedSemaphore(Semaphore):
|
||||
def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ...
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
from _typeshed import Incomplete
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import ClassVar, Literal, Protocol, overload
|
||||
from typing import Literal, Protocol, overload
|
||||
|
||||
__all__ = ["Number", "Complex", "Real", "Rational", "Integral"]
|
||||
|
||||
@@ -102,7 +102,6 @@ class Complex(Number, _ComplexLike):
|
||||
def conjugate(self) -> _ComplexLike: ...
|
||||
@abstractmethod
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
# See comment at the top of the file
|
||||
# for why some of these return types are purposefully vague
|
||||
|
||||
@@ -54,7 +54,7 @@ from _operator import (
|
||||
)
|
||||
from _typeshed import SupportsGetItem
|
||||
from typing import Any, Generic, TypeVar, final, overload
|
||||
from typing_extensions import Self, TypeVarTuple, Unpack
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
@@ -211,5 +211,5 @@ class itemgetter(Generic[_T_co]):
|
||||
|
||||
@final
|
||||
class methodcaller:
|
||||
def __new__(cls, name: str, /, *args: Any, **kwargs: Any) -> Self: ...
|
||||
def __init__(self, name: str, /, *args: Any, **kwargs: Any) -> None: ...
|
||||
def __call__(self, obj: Any) -> Any: ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import builtins
|
||||
from _typeshed import Incomplete, MaybeNone
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
from typing import IO, Any, AnyStr, ClassVar, Literal, NoReturn, overload
|
||||
from typing_extensions import Self
|
||||
from typing import IO, Any, AnyStr, Literal, NoReturn, overload
|
||||
|
||||
__all__ = [
|
||||
"Option",
|
||||
@@ -29,9 +27,8 @@ NO_DEFAULT: tuple[str, ...]
|
||||
SUPPRESS_HELP: str
|
||||
SUPPRESS_USAGE: str
|
||||
|
||||
# Can return complex, float, or int depending on the option's type
|
||||
def check_builtin(option: Option, opt: str, value: str) -> complex: ...
|
||||
def check_choice(option: Option, opt: str, value: str) -> str: ...
|
||||
def check_builtin(option: Option, opt, value: str): ...
|
||||
def check_choice(option: Option, opt, value: str) -> str: ...
|
||||
|
||||
class OptParseError(Exception):
|
||||
msg: str
|
||||
@@ -65,11 +62,9 @@ class HelpFormatter:
|
||||
max_help_position: int
|
||||
option_strings: dict[Option, str]
|
||||
parser: OptionParser
|
||||
short_first: bool | Literal[0, 1]
|
||||
short_first: Incomplete
|
||||
width: int
|
||||
def __init__(
|
||||
self, indent_increment: int, max_help_position: int, width: int | None, short_first: bool | Literal[0, 1]
|
||||
) -> None: ...
|
||||
def __init__(self, indent_increment: int, max_help_position: int, width: int | None, short_first: int) -> None: ...
|
||||
def dedent(self) -> None: ...
|
||||
def expand_default(self, option: Option) -> str: ...
|
||||
def format_description(self, description: str | None) -> str: ...
|
||||
@@ -88,22 +83,14 @@ class HelpFormatter:
|
||||
|
||||
class IndentedHelpFormatter(HelpFormatter):
|
||||
def __init__(
|
||||
self,
|
||||
indent_increment: int = 2,
|
||||
max_help_position: int = 24,
|
||||
width: int | None = None,
|
||||
short_first: bool | Literal[0, 1] = 1,
|
||||
self, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None, short_first: int = 1
|
||||
) -> None: ...
|
||||
def format_heading(self, heading: str) -> str: ...
|
||||
def format_usage(self, usage: str) -> str: ...
|
||||
|
||||
class TitledHelpFormatter(HelpFormatter):
|
||||
def __init__(
|
||||
self,
|
||||
indent_increment: int = 0,
|
||||
max_help_position: int = 24,
|
||||
width: int | None = None,
|
||||
short_first: bool | Literal[0, 1] = 0,
|
||||
self, indent_increment: int = 0, max_help_position: int = 24, width: int | None = None, short_first: int = 0
|
||||
) -> None: ...
|
||||
def format_heading(self, heading: str) -> str: ...
|
||||
def format_usage(self, usage: str) -> str: ...
|
||||
@@ -112,46 +99,25 @@ class Option:
|
||||
ACTIONS: tuple[str, ...]
|
||||
ALWAYS_TYPED_ACTIONS: tuple[str, ...]
|
||||
ATTRS: list[str]
|
||||
CHECK_METHODS: list[Callable[[Self], object]] | None
|
||||
CHECK_METHODS: list[Callable[..., Incomplete]] | None
|
||||
CONST_ACTIONS: tuple[str, ...]
|
||||
STORE_ACTIONS: tuple[str, ...]
|
||||
TYPED_ACTIONS: tuple[str, ...]
|
||||
TYPES: tuple[str, ...]
|
||||
TYPE_CHECKER: dict[str, Callable[[Option, str, str], object]]
|
||||
TYPE_CHECKER: dict[str, Callable[[Option, str, Incomplete], Any]]
|
||||
_long_opts: list[str]
|
||||
_short_opts: list[str]
|
||||
action: str
|
||||
type: str | None
|
||||
dest: str | None
|
||||
default: Any # default can be "any" type
|
||||
default: Incomplete
|
||||
nargs: int
|
||||
const: Any | None # const can be "any" type
|
||||
choices: list[str] | tuple[str, ...] | None
|
||||
# Callback args and kwargs cannot be expressed in Python's type system.
|
||||
# Revisit if ParamSpec is ever changed to work with packed args/kwargs.
|
||||
callback: Callable[..., object] | None
|
||||
callback_args: tuple[Any, ...] | None
|
||||
callback_kwargs: dict[str, Any] | None
|
||||
type: Incomplete
|
||||
callback: Callable[..., Incomplete] | None
|
||||
callback_args: tuple[Incomplete, ...] | None
|
||||
callback_kwargs: dict[str, Incomplete] | None
|
||||
help: str | None
|
||||
metavar: str | None
|
||||
def __init__(
|
||||
self,
|
||||
*opts: str | None,
|
||||
# The following keywords are handled by the _set_attrs method. All default to
|
||||
# `None` except for `default`, which defaults to `NO_DEFAULT`.
|
||||
action: str | None = None,
|
||||
type: str | builtins.type | None = None,
|
||||
dest: str | None = None,
|
||||
default: Any = ..., # = NO_DEFAULT
|
||||
nargs: int | None = None,
|
||||
const: Any | None = None,
|
||||
choices: list[str] | tuple[str, ...] | None = None,
|
||||
callback: Callable[..., object] | None = None,
|
||||
callback_args: tuple[Any, ...] | None = None,
|
||||
callback_kwargs: dict[str, Any] | None = None,
|
||||
help: str | None = None,
|
||||
metavar: str | None = None,
|
||||
) -> None: ...
|
||||
def __init__(self, *opts: str | None, **attrs) -> None: ...
|
||||
def _check_action(self) -> None: ...
|
||||
def _check_callback(self) -> None: ...
|
||||
def _check_choice(self) -> None: ...
|
||||
@@ -160,14 +126,13 @@ class Option:
|
||||
def _check_nargs(self) -> None: ...
|
||||
def _check_opt_strings(self, opts: Iterable[str | None]) -> list[str]: ...
|
||||
def _check_type(self) -> None: ...
|
||||
def _set_attrs(self, attrs: dict[str, Any]) -> None: ... # accepted attrs depend on the ATTRS attribute
|
||||
def _set_attrs(self, attrs: dict[str, Incomplete]) -> None: ...
|
||||
def _set_opt_strings(self, opts: Iterable[str]) -> None: ...
|
||||
def check_value(self, opt: str, value: str) -> Any: ... # return type cannot be known statically
|
||||
def convert_value(self, opt: str, value: str | tuple[str, ...] | None) -> Any: ... # return type cannot be known statically
|
||||
def check_value(self, opt: str, value): ...
|
||||
def convert_value(self, opt: str, value): ...
|
||||
def get_opt_string(self) -> str: ...
|
||||
def process(self, opt: str, value: str | tuple[str, ...] | None, values: Values, parser: OptionParser) -> int: ...
|
||||
# value of take_action can be "any" type
|
||||
def take_action(self, action: str, dest: str, opt: str, value: Any, values: Values, parser: OptionParser) -> int: ...
|
||||
def process(self, opt, value, values, parser: OptionParser) -> int: ...
|
||||
def take_action(self, action: str, dest: str, opt, value, values, parser: OptionParser) -> int: ...
|
||||
def takes_value(self) -> bool: ...
|
||||
|
||||
make_option = Option
|
||||
@@ -176,7 +141,7 @@ class OptionContainer:
|
||||
_long_opt: dict[str, Option]
|
||||
_short_opt: dict[str, Option]
|
||||
conflict_handler: str
|
||||
defaults: dict[str, Any] # default values can be "any" type
|
||||
defaults: dict[str, Incomplete]
|
||||
description: str | None
|
||||
option_class: type[Option]
|
||||
def __init__(
|
||||
@@ -188,25 +153,7 @@ class OptionContainer:
|
||||
@overload
|
||||
def add_option(self, opt: Option, /) -> Option: ...
|
||||
@overload
|
||||
def add_option(
|
||||
self,
|
||||
opt_str: str,
|
||||
/,
|
||||
*opts: str | None,
|
||||
action: str | None = None,
|
||||
type: str | builtins.type | None = None,
|
||||
dest: str | None = None,
|
||||
default: Any = ..., # = NO_DEFAULT
|
||||
nargs: int | None = None,
|
||||
const: Any | None = None,
|
||||
choices: list[str] | tuple[str, ...] | None = None,
|
||||
callback: Callable[..., object] | None = None,
|
||||
callback_args: tuple[Any, ...] | None = None,
|
||||
callback_kwargs: dict[str, Any] | None = None,
|
||||
help: str | None = None,
|
||||
metavar: str | None = None,
|
||||
**kwargs, # Allow arbitrary keyword arguments for user defined option_class
|
||||
) -> Option: ...
|
||||
def add_option(self, arg: str, /, *args: str | None, **kwargs) -> Option: ...
|
||||
def add_options(self, option_list: Iterable[Option]) -> None: ...
|
||||
def destroy(self) -> None: ...
|
||||
def format_option_help(self, formatter: HelpFormatter) -> str: ...
|
||||
@@ -228,19 +175,17 @@ class OptionGroup(OptionContainer):
|
||||
def set_title(self, title: str) -> None: ...
|
||||
|
||||
class Values:
|
||||
def __init__(self, defaults: Mapping[str, object] | None = None) -> None: ...
|
||||
def _update(self, dict: Mapping[str, object], mode: Literal["careful", "loose"]) -> None: ...
|
||||
def _update_careful(self, dict: Mapping[str, object]) -> None: ...
|
||||
def _update_loose(self, dict: Mapping[str, object]) -> None: ...
|
||||
def ensure_value(self, attr: str, value: object) -> Any: ... # return type cannot be known statically
|
||||
def read_file(self, filename: str, mode: Literal["careful", "loose"] = "careful") -> None: ...
|
||||
def read_module(self, modname: str, mode: Literal["careful", "loose"] = "careful") -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __init__(self, defaults: Mapping[str, Incomplete] | None = None) -> None: ...
|
||||
def _update(self, dict: Mapping[str, Incomplete], mode) -> None: ...
|
||||
def _update_careful(self, dict: Mapping[str, Incomplete]) -> None: ...
|
||||
def _update_loose(self, dict: Mapping[str, Incomplete]) -> None: ...
|
||||
def ensure_value(self, attr: str, value): ...
|
||||
def read_file(self, filename: str, mode: str = "careful") -> None: ...
|
||||
def read_module(self, modname: str, mode: str = "careful") -> None: ...
|
||||
# __getattr__ doesn't exist, but anything passed as a default to __init__
|
||||
# is set on the instance.
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
# TODO mypy infers -> object for __getattr__ if __setattr__ has `value: object`
|
||||
def __setattr__(self, name: str, value: Any, /) -> None: ...
|
||||
def __getattr__(self, name: str): ...
|
||||
def __setattr__(self, name: str, value, /) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
class OptionParser(OptionContainer):
|
||||
@@ -284,7 +229,7 @@ class OptionParser(OptionContainer):
|
||||
@overload
|
||||
def add_option_group(self, opt_group: OptionGroup, /) -> OptionGroup: ...
|
||||
@overload
|
||||
def add_option_group(self, title: str, /, description: str | None = None) -> OptionGroup: ...
|
||||
def add_option_group(self, *args, **kwargs) -> OptionGroup: ...
|
||||
def check_values(self, values: Values, args: list[str]) -> tuple[Values, list[str]]: ...
|
||||
def disable_interspersed_args(self) -> None: ...
|
||||
def enable_interspersed_args(self) -> None: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from _typeshed import StrOrBytesPath
|
||||
from collections.abc import Sequence
|
||||
from types import CodeType
|
||||
from typing import Any, ClassVar, final
|
||||
from typing import Any, final
|
||||
|
||||
def expr(source: str) -> STType: ...
|
||||
def suite(source: str) -> STType: ...
|
||||
@@ -17,7 +17,6 @@ class ParserError(Exception): ...
|
||||
|
||||
@final
|
||||
class STType:
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def compile(self, filename: StrOrBytesPath = ...) -> CodeType: ...
|
||||
def isexpr(self) -> bool: ...
|
||||
def issuite(self) -> bool: ...
|
||||
|
||||
@@ -15,7 +15,6 @@ from _pickle import (
|
||||
from _typeshed import ReadableBuffer, SupportsWrite
|
||||
from collections.abc import Callable, Iterable, Mapping
|
||||
from typing import Any, ClassVar, SupportsBytes, SupportsIndex, final
|
||||
from typing_extensions import Self
|
||||
|
||||
__all__ = [
|
||||
"PickleBuffer",
|
||||
@@ -109,7 +108,7 @@ bytes_types: tuple[type[Any], ...] # undocumented
|
||||
|
||||
@final
|
||||
class PickleBuffer:
|
||||
def __new__(cls, buffer: ReadableBuffer) -> Self: ...
|
||||
def __init__(self, buffer: ReadableBuffer) -> None: ...
|
||||
def raw(self) -> memoryview: ...
|
||||
def release(self) -> None: ...
|
||||
def __buffer__(self, flags: int, /) -> memoryview: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer
|
||||
from collections.abc import Mapping, MutableMapping
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import IO, Any, ClassVar
|
||||
from typing import IO, Any
|
||||
from typing_extensions import Self
|
||||
|
||||
__all__ = ["InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps", "UID"]
|
||||
@@ -100,7 +100,6 @@ if sys.version_info < (3, 9):
|
||||
class Data:
|
||||
data: bytes
|
||||
def __init__(self, data: bytes) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class UID:
|
||||
data: int
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
from typing import Any, ClassVar, NamedTuple, type_check_only
|
||||
from typing import Any, NamedTuple, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = ["scheduler"]
|
||||
@@ -25,8 +25,7 @@ else:
|
||||
argument: tuple[Any, ...]
|
||||
kwargs: dict[str, Any]
|
||||
|
||||
class Event(_EventBase):
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
class Event(_EventBase): ...
|
||||
|
||||
class scheduler:
|
||||
timefunc: Callable[[], float]
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
from _typeshed import FileDescriptorLike
|
||||
from collections.abc import Iterable
|
||||
from types import TracebackType
|
||||
from typing import Any, ClassVar, final
|
||||
from typing import Any, final
|
||||
from typing_extensions import Self
|
||||
|
||||
if sys.platform != "win32":
|
||||
@@ -22,14 +22,11 @@ if sys.platform != "win32":
|
||||
POLLWRBAND: int
|
||||
POLLWRNORM: int
|
||||
|
||||
# This is actually a function that returns an instance of a class.
|
||||
# The class is not accessible directly, and also calls itself select.poll.
|
||||
class poll:
|
||||
# default value is select.POLLIN | select.POLLPRI | select.POLLOUT
|
||||
def register(self, fd: FileDescriptorLike, eventmask: int = 7, /) -> None: ...
|
||||
def modify(self, fd: FileDescriptorLike, eventmask: int, /) -> None: ...
|
||||
def unregister(self, fd: FileDescriptorLike, /) -> None: ...
|
||||
def poll(self, timeout: float | None = None, /) -> list[tuple[int, int]]: ...
|
||||
class poll:
|
||||
def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
|
||||
def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ...
|
||||
def unregister(self, fd: FileDescriptorLike) -> None: ...
|
||||
def poll(self, timeout: float | None = ...) -> list[tuple[int, int]]: ...
|
||||
|
||||
def select(
|
||||
rlist: Iterable[Any], wlist: Iterable[Any], xlist: Iterable[Any], timeout: float | None = None, /
|
||||
@@ -56,7 +53,6 @@ if sys.platform != "linux" and sys.platform != "win32":
|
||||
data: Any = ...,
|
||||
udata: Any = ...,
|
||||
) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
# BSD only
|
||||
@final
|
||||
|
||||
@@ -50,10 +50,8 @@ if sys.platform == "linux":
|
||||
class EpollSelector(_PollLikeSelector):
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":
|
||||
# Solaris only
|
||||
class DevpollSelector(_PollLikeSelector):
|
||||
def fileno(self) -> int: ...
|
||||
class DevpollSelector(_PollLikeSelector):
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
if sys.platform != "win32" and sys.platform != "linux":
|
||||
class KqueueSelector(_BaseSelectorImpl):
|
||||
|
||||
@@ -3,7 +3,7 @@ from _typeshed import structseq
|
||||
from collections.abc import Callable, Iterable
|
||||
from enum import IntEnum
|
||||
from types import FrameType
|
||||
from typing import Any, Final, Literal, final
|
||||
from typing import Any, Final, final
|
||||
from typing_extensions import Never, TypeAlias
|
||||
|
||||
NSIG: int
|
||||
@@ -61,8 +61,8 @@ class Handlers(IntEnum):
|
||||
SIG_DFL = 0
|
||||
SIG_IGN = 1
|
||||
|
||||
SIG_DFL: Literal[Handlers.SIG_DFL]
|
||||
SIG_IGN: Literal[Handlers.SIG_IGN]
|
||||
SIG_DFL: Handlers
|
||||
SIG_IGN: Handlers
|
||||
|
||||
_SIGNUM: TypeAlias = int | Signals
|
||||
_HANDLER: TypeAlias = Callable[[int, FrameType | None], Any] | int | Handlers | None
|
||||
@@ -77,45 +77,45 @@ else:
|
||||
def getsignal(signalnum: _SIGNUM, /) -> _HANDLER: ...
|
||||
def signal(signalnum: _SIGNUM, handler: _HANDLER, /) -> _HANDLER: ...
|
||||
|
||||
SIGABRT: Literal[Signals.SIGABRT]
|
||||
SIGFPE: Literal[Signals.SIGFPE]
|
||||
SIGILL: Literal[Signals.SIGILL]
|
||||
SIGINT: Literal[Signals.SIGINT]
|
||||
SIGSEGV: Literal[Signals.SIGSEGV]
|
||||
SIGTERM: Literal[Signals.SIGTERM]
|
||||
SIGABRT: Signals
|
||||
SIGFPE: Signals
|
||||
SIGILL: Signals
|
||||
SIGINT: Signals
|
||||
SIGSEGV: Signals
|
||||
SIGTERM: Signals
|
||||
|
||||
if sys.platform == "win32":
|
||||
SIGBREAK: Literal[Signals.SIGBREAK]
|
||||
CTRL_C_EVENT: Literal[Signals.CTRL_C_EVENT]
|
||||
CTRL_BREAK_EVENT: Literal[Signals.CTRL_BREAK_EVENT]
|
||||
SIGBREAK: Signals
|
||||
CTRL_C_EVENT: Signals
|
||||
CTRL_BREAK_EVENT: Signals
|
||||
else:
|
||||
if sys.platform != "linux":
|
||||
SIGINFO: Literal[Signals.SIGINFO]
|
||||
SIGEMT: Literal[Signals.SIGEMT]
|
||||
SIGALRM: Literal[Signals.SIGALRM]
|
||||
SIGBUS: Literal[Signals.SIGBUS]
|
||||
SIGCHLD: Literal[Signals.SIGCHLD]
|
||||
SIGCONT: Literal[Signals.SIGCONT]
|
||||
SIGHUP: Literal[Signals.SIGHUP]
|
||||
SIGIO: Literal[Signals.SIGIO]
|
||||
SIGIOT: Literal[Signals.SIGABRT] # alias
|
||||
SIGKILL: Literal[Signals.SIGKILL]
|
||||
SIGPIPE: Literal[Signals.SIGPIPE]
|
||||
SIGPROF: Literal[Signals.SIGPROF]
|
||||
SIGQUIT: Literal[Signals.SIGQUIT]
|
||||
SIGSTOP: Literal[Signals.SIGSTOP]
|
||||
SIGSYS: Literal[Signals.SIGSYS]
|
||||
SIGTRAP: Literal[Signals.SIGTRAP]
|
||||
SIGTSTP: Literal[Signals.SIGTSTP]
|
||||
SIGTTIN: Literal[Signals.SIGTTIN]
|
||||
SIGTTOU: Literal[Signals.SIGTTOU]
|
||||
SIGURG: Literal[Signals.SIGURG]
|
||||
SIGUSR1: Literal[Signals.SIGUSR1]
|
||||
SIGUSR2: Literal[Signals.SIGUSR2]
|
||||
SIGVTALRM: Literal[Signals.SIGVTALRM]
|
||||
SIGWINCH: Literal[Signals.SIGWINCH]
|
||||
SIGXCPU: Literal[Signals.SIGXCPU]
|
||||
SIGXFSZ: Literal[Signals.SIGXFSZ]
|
||||
SIGINFO: Signals
|
||||
SIGEMT: Signals
|
||||
SIGALRM: Signals
|
||||
SIGBUS: Signals
|
||||
SIGCHLD: Signals
|
||||
SIGCONT: Signals
|
||||
SIGHUP: Signals
|
||||
SIGIO: Signals
|
||||
SIGIOT: Signals
|
||||
SIGKILL: Signals
|
||||
SIGPIPE: Signals
|
||||
SIGPROF: Signals
|
||||
SIGQUIT: Signals
|
||||
SIGSTOP: Signals
|
||||
SIGSYS: Signals
|
||||
SIGTRAP: Signals
|
||||
SIGTSTP: Signals
|
||||
SIGTTIN: Signals
|
||||
SIGTTOU: Signals
|
||||
SIGURG: Signals
|
||||
SIGUSR1: Signals
|
||||
SIGUSR2: Signals
|
||||
SIGVTALRM: Signals
|
||||
SIGWINCH: Signals
|
||||
SIGXCPU: Signals
|
||||
SIGXFSZ: Signals
|
||||
|
||||
class ItimerError(OSError): ...
|
||||
ITIMER_PROF: int
|
||||
@@ -127,9 +127,9 @@ else:
|
||||
SIG_UNBLOCK = 1
|
||||
SIG_SETMASK = 2
|
||||
|
||||
SIG_BLOCK: Literal[Sigmasks.SIG_BLOCK]
|
||||
SIG_UNBLOCK: Literal[Sigmasks.SIG_UNBLOCK]
|
||||
SIG_SETMASK: Literal[Sigmasks.SIG_SETMASK]
|
||||
SIG_BLOCK = Sigmasks.SIG_BLOCK
|
||||
SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK
|
||||
SIG_SETMASK = Sigmasks.SIG_SETMASK
|
||||
def alarm(seconds: int, /) -> int: ...
|
||||
def getitimer(which: int, /) -> tuple[float, float]: ...
|
||||
def pause() -> None: ...
|
||||
@@ -147,13 +147,13 @@ else:
|
||||
else:
|
||||
def sigwait(sigset: Iterable[int], /) -> _SIGNUM: ...
|
||||
if sys.platform != "darwin":
|
||||
SIGCLD: Literal[Signals.SIGCHLD] # alias
|
||||
SIGPOLL: Literal[Signals.SIGIO] # alias
|
||||
SIGPWR: Literal[Signals.SIGPWR]
|
||||
SIGRTMAX: Literal[Signals.SIGRTMAX]
|
||||
SIGRTMIN: Literal[Signals.SIGRTMIN]
|
||||
SIGCLD: Signals
|
||||
SIGPOLL: Signals
|
||||
SIGPWR: Signals
|
||||
SIGRTMAX: Signals
|
||||
SIGRTMIN: Signals
|
||||
if sys.version_info >= (3, 11):
|
||||
SIGSTKFLT: Literal[Signals.SIGSTKFLT]
|
||||
SIGSTKFLT: Signals
|
||||
|
||||
@final
|
||||
class struct_siginfo(structseq[int], tuple[int, int, int, int, int, int, int]):
|
||||
|
||||
@@ -429,7 +429,7 @@ class PrepareProtocol:
|
||||
def __init__(self, *args: object, **kwargs: object) -> None: ...
|
||||
|
||||
class Row(Sequence[Any]):
|
||||
def __new__(cls, cursor: Cursor, data: tuple[Any, ...], /) -> Self: ...
|
||||
def __init__(self, cursor: Cursor, data: tuple[Any, ...], /) -> None: ...
|
||||
def keys(self) -> list[str]: ...
|
||||
@overload
|
||||
def __getitem__(self, key: int | str, /) -> Any: ...
|
||||
|
||||
@@ -325,10 +325,6 @@ class _ASN1Object(_ASN1ObjectBase):
|
||||
def fromname(cls, name: str) -> Self: ...
|
||||
|
||||
class Purpose(_ASN1Object, enum.Enum):
|
||||
# Normally this class would inherit __new__ from _ASN1Object, but
|
||||
# because this is an enum, the inherited __new__ is replaced at runtime with
|
||||
# Enum.__new__.
|
||||
def __new__(cls, value: object) -> Self: ...
|
||||
SERVER_AUTH = (129, "serverAuth", "TLS Web Server Authentication", "1.3.6.1.5.5.7.3.2") # pyright: ignore[reportCallIssue]
|
||||
CLIENT_AUTH = (130, "clientAuth", "TLS Web Client Authentication", "1.3.6.1.5.5.7.3.1") # pyright: ignore[reportCallIssue]
|
||||
|
||||
|
||||
@@ -100,22 +100,30 @@ class Thread:
|
||||
class _DummyThread(Thread):
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
# This is actually the function _thread.allocate_lock for <= 3.12
|
||||
Lock = _thread.LockType
|
||||
@final
|
||||
class Lock:
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
def locked(self) -> bool: ...
|
||||
def acquire_lock(self, blocking: bool = ..., timeout: float = ...) -> bool: ... # undocumented
|
||||
def release_lock(self) -> None: ... # undocumented
|
||||
def locked_lock(self) -> bool: ... # undocumented
|
||||
|
||||
# Python implementation of RLock.
|
||||
@final
|
||||
class _RLock:
|
||||
_count: int
|
||||
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
__enter__ = acquire
|
||||
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
|
||||
RLock = _thread.RLock # Actually a function at runtime.
|
||||
RLock = _RLock
|
||||
|
||||
class Condition:
|
||||
def __init__(self, lock: Lock | _RLock | RLock | None = None) -> None: ...
|
||||
def __init__(self, lock: Lock | _RLock | None = None) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
|
||||
@@ -5,7 +5,7 @@ from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
from tkinter.constants import *
|
||||
from tkinter.font import _FontDescription
|
||||
from types import TracebackType
|
||||
from typing import Any, ClassVar, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only
|
||||
from typing import Any, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only
|
||||
from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
@@ -330,7 +330,6 @@ class Variable:
|
||||
def trace_vinfo(self): ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __del__(self) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class StringVar(Variable):
|
||||
def __init__(self, master: Misc | None = None, value: str | None = None, name: str | None = None) -> None: ...
|
||||
@@ -371,9 +370,6 @@ class _GridIndexInfo(TypedDict, total=False):
|
||||
uniform: str | None
|
||||
weight: int
|
||||
|
||||
class _BusyInfo(TypedDict):
|
||||
cursor: _Cursor
|
||||
|
||||
class Misc:
|
||||
master: Misc | None
|
||||
tk: _tkinter.TkappType
|
||||
@@ -411,25 +407,6 @@ class Misc:
|
||||
def after_info(self, id: str | None = None) -> tuple[str, ...]: ...
|
||||
|
||||
def bell(self, displayof: Literal[0] | Misc | None = 0) -> None: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
# Supports options from `_BusyInfo``
|
||||
def tk_busy_cget(self, option: Literal["cursor"]) -> _Cursor: ...
|
||||
busy_cget = tk_busy_cget
|
||||
def tk_busy_configure(self, cnf: Any = None, **kw: Any) -> Any: ...
|
||||
tk_busy_config = tk_busy_configure
|
||||
busy_configure = tk_busy_configure
|
||||
busy_config = tk_busy_configure
|
||||
def tk_busy_current(self, pattern: str | None = None) -> list[Misc]: ...
|
||||
busy_current = tk_busy_current
|
||||
def tk_busy_forget(self) -> None: ...
|
||||
busy_forget = tk_busy_forget
|
||||
def tk_busy_hold(self, **kw: Unpack[_BusyInfo]) -> None: ...
|
||||
tk_busy = tk_busy_hold
|
||||
busy_hold = tk_busy_hold
|
||||
busy = tk_busy_hold
|
||||
def tk_busy_status(self) -> bool: ...
|
||||
busy_status = tk_busy_status
|
||||
|
||||
def clipboard_get(self, *, displayof: Misc = ..., type: str = ...) -> str: ...
|
||||
def clipboard_clear(self, *, displayof: Misc = ...) -> None: ...
|
||||
def clipboard_append(self, string: str, *, displayof: Misc = ..., format: str = ..., type: str = ...) -> None: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ import itertools
|
||||
import sys
|
||||
import tkinter
|
||||
from typing import Any, ClassVar, Final, Literal, TypedDict, overload
|
||||
from typing_extensions import TypeAlias, Unpack
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = ["NORMAL", "ROMAN", "BOLD", "ITALIC", "nametofont", "Font", "families", "names"]
|
||||
@@ -18,9 +18,9 @@ _FontDescription: TypeAlias = (
|
||||
| Font # A font object constructed in Python
|
||||
| list[Any] # ["Helvetica", 12, BOLD]
|
||||
| tuple[str] # ("Liberation Sans",) needs wrapping in tuple/list to handle spaces
|
||||
# ("Liberation Sans", 12) or ("Liberation Sans", 12, "bold", "italic", "underline")
|
||||
| tuple[str, int, Unpack[tuple[str, ...]]] # Any number of trailing options is permitted
|
||||
| tuple[str, int, list[str] | tuple[str, ...]] # Options can also be passed as list/tuple
|
||||
| tuple[str, int] # ("Liberation Sans", 12)
|
||||
| tuple[str, int, str] # ("Liberation Sans", 12, "bold")
|
||||
| tuple[str, int, list[str] | tuple[str, ...]] # e.g. bold and italic
|
||||
| _tkinter.Tcl_Obj # A font object constructed in Tcl
|
||||
)
|
||||
|
||||
@@ -58,7 +58,6 @@ class Font:
|
||||
underline: bool = ...,
|
||||
overstrike: bool = ...,
|
||||
) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __setitem__(self, key: str, value: Any) -> None: ...
|
||||
@overload
|
||||
def cget(self, option: Literal["family"]) -> str: ...
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
from _typeshed import SupportsWrite, Unused
|
||||
from collections.abc import Generator, Iterable, Iterator, Mapping
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Any, ClassVar, Literal, overload
|
||||
from typing import Any, Literal, overload
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
|
||||
__all__ = [
|
||||
@@ -113,26 +113,17 @@ if sys.version_info >= (3, 11):
|
||||
def emit(self, text_gen: str | Iterable[str], margin_char: str | None = None) -> Generator[str, None, None]: ...
|
||||
|
||||
class TracebackException:
|
||||
__cause__: TracebackException | None
|
||||
__context__: TracebackException | None
|
||||
__cause__: TracebackException
|
||||
__context__: TracebackException
|
||||
if sys.version_info >= (3, 11):
|
||||
exceptions: list[TracebackException] | None
|
||||
__suppress_context__: bool
|
||||
if sys.version_info >= (3, 11):
|
||||
__notes__: list[str] | None
|
||||
stack: StackSummary
|
||||
|
||||
# These fields only exist for `SyntaxError`s, but there is no way to express that in the type system.
|
||||
filename: str
|
||||
lineno: str | None
|
||||
if sys.version_info >= (3, 10):
|
||||
end_lineno: str | None
|
||||
lineno: int
|
||||
text: str
|
||||
offset: int
|
||||
if sys.version_info >= (3, 10):
|
||||
end_offset: int | None
|
||||
msg: str
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
@property
|
||||
def exc_type_str(self) -> str: ...
|
||||
@@ -229,7 +220,6 @@ class TracebackException:
|
||||
) -> Self: ...
|
||||
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
if sys.version_info >= (3, 11):
|
||||
def format(self, *, chain: bool = True, _ctx: _ExceptionPrintContext | None = None) -> Generator[str, None, None]: ...
|
||||
else:
|
||||
@@ -293,7 +283,6 @@ class FrameSummary:
|
||||
def __iter__(self) -> Iterator[Any]: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __len__(self) -> Literal[4]: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class StackSummary(list[FrameSummary]):
|
||||
@classmethod
|
||||
|
||||
@@ -89,26 +89,14 @@ class FunctionType:
|
||||
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
|
||||
|
||||
__module__: str
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(
|
||||
cls,
|
||||
code: CodeType,
|
||||
globals: dict[str, Any],
|
||||
name: str | None = None,
|
||||
argdefs: tuple[object, ...] | None = None,
|
||||
closure: tuple[CellType, ...] | None = None,
|
||||
kwdefaults: dict[str, object] | None = None,
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __new__(
|
||||
cls,
|
||||
code: CodeType,
|
||||
globals: dict[str, Any],
|
||||
name: str | None = None,
|
||||
argdefs: tuple[object, ...] | None = None,
|
||||
closure: tuple[CellType, ...] | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
code: CodeType,
|
||||
globals: dict[str, Any],
|
||||
name: str | None = ...,
|
||||
argdefs: tuple[object, ...] | None = ...,
|
||||
closure: tuple[CellType, ...] | None = ...,
|
||||
) -> Self: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
@overload
|
||||
def __get__(self, instance: None, owner: type, /) -> FunctionType: ...
|
||||
@@ -374,12 +362,6 @@ _ReturnT_co = TypeVar("_ReturnT_co", covariant=True)
|
||||
|
||||
@final
|
||||
class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]):
|
||||
@property
|
||||
def gi_code(self) -> CodeType: ...
|
||||
@property
|
||||
def gi_frame(self) -> FrameType: ...
|
||||
@property
|
||||
def gi_running(self) -> bool: ...
|
||||
@property
|
||||
def gi_yieldfrom(self) -> GeneratorType[_YieldT_co, _SendT_contra, Any] | None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
@@ -403,12 +385,6 @@ class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]):
|
||||
class AsyncGeneratorType(AsyncGenerator[_YieldT_co, _SendT_contra]):
|
||||
@property
|
||||
def ag_await(self) -> Awaitable[Any] | None: ...
|
||||
@property
|
||||
def ag_code(self) -> CodeType: ...
|
||||
@property
|
||||
def ag_frame(self) -> FrameType: ...
|
||||
@property
|
||||
def ag_running(self) -> bool: ...
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
if sys.version_info >= (3, 12):
|
||||
@@ -433,14 +409,6 @@ class CoroutineType(Coroutine[_YieldT_co, _SendT_contra, _ReturnT_co]):
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
@property
|
||||
def cr_await(self) -> Any | None: ...
|
||||
@property
|
||||
def cr_code(self) -> CodeType: ...
|
||||
@property
|
||||
def cr_frame(self) -> FrameType: ...
|
||||
@property
|
||||
def cr_running(self) -> bool: ...
|
||||
@property
|
||||
def cr_origin(self) -> tuple[tuple[str, int, str], ...] | None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
@property
|
||||
@@ -474,7 +442,7 @@ class MethodType:
|
||||
def __name__(self) -> str: ... # inherited from the added function
|
||||
@property
|
||||
def __qualname__(self) -> str: ... # inherited from the added function
|
||||
def __new__(cls, func: Callable[..., Any], instance: object, /) -> Self: ...
|
||||
def __new__(cls, func: Callable[..., Any], obj: object, /) -> Self: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
@@ -636,7 +604,7 @@ if sys.version_info >= (3, 9):
|
||||
def __args__(self) -> tuple[Any, ...]: ...
|
||||
@property
|
||||
def __parameters__(self) -> tuple[Any, ...]: ...
|
||||
def __new__(cls, origin: type, args: Any, /) -> Self: ...
|
||||
def __new__(cls, origin: type, args: Any) -> Self: ...
|
||||
def __getitem__(self, typeargs: Any, /) -> GenericAlias: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
@@ -12,6 +12,7 @@ from re import Match as Match, Pattern as Pattern
|
||||
from types import (
|
||||
BuiltinFunctionType,
|
||||
CodeType,
|
||||
FrameType,
|
||||
FunctionType,
|
||||
MethodDescriptorType,
|
||||
MethodType,
|
||||
@@ -154,8 +155,8 @@ class TypeVar:
|
||||
@property
|
||||
def __default__(self) -> Any: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
*constraints: Any,
|
||||
bound: Any | None = None,
|
||||
@@ -163,21 +164,17 @@ class TypeVar:
|
||||
covariant: bool = False,
|
||||
infer_variance: bool = False,
|
||||
default: Any = ...,
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
elif sys.version_info >= (3, 12):
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
*constraints: Any,
|
||||
bound: Any | None = None,
|
||||
covariant: bool = False,
|
||||
contravariant: bool = False,
|
||||
infer_variance: bool = False,
|
||||
) -> Self: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
def __new__(
|
||||
cls, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False
|
||||
@@ -235,9 +232,7 @@ if sys.version_info >= (3, 11):
|
||||
def __default__(self) -> Any: ...
|
||||
def has_default(self) -> bool: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(cls, name: str, *, default: Any = ...) -> Self: ...
|
||||
elif sys.version_info >= (3, 12):
|
||||
def __new__(cls, name: str) -> Self: ...
|
||||
def __init__(self, name: str, *, default: Any = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, name: str) -> None: ...
|
||||
|
||||
@@ -250,25 +245,15 @@ if sys.version_info >= (3, 10):
|
||||
class ParamSpecArgs:
|
||||
@property
|
||||
def __origin__(self) -> ParamSpec: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, origin: ParamSpec) -> Self: ...
|
||||
else:
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
@final
|
||||
class ParamSpecKwargs:
|
||||
@property
|
||||
def __origin__(self) -> ParamSpec: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, origin: ParamSpec) -> Self: ...
|
||||
else:
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
@final
|
||||
class ParamSpec:
|
||||
@@ -287,8 +272,8 @@ if sys.version_info >= (3, 10):
|
||||
@property
|
||||
def __default__(self) -> Any: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
*,
|
||||
bound: Any | None = None,
|
||||
@@ -296,21 +281,17 @@ if sys.version_info >= (3, 10):
|
||||
covariant: bool = False,
|
||||
infer_variance: bool = False,
|
||||
default: Any = ...,
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
elif sys.version_info >= (3, 12):
|
||||
def __new__(
|
||||
cls,
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
*,
|
||||
bound: Any | None = None,
|
||||
contravariant: bool = False,
|
||||
covariant: bool = False,
|
||||
infer_variance: bool = False,
|
||||
) -> Self: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
def __new__(
|
||||
cls, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False
|
||||
) -> Self: ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False
|
||||
@@ -352,8 +333,6 @@ _F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_P = _ParamSpec("_P")
|
||||
_T = TypeVar("_T")
|
||||
|
||||
_FT = TypeVar("_FT", bound=Callable[..., Any] | type)
|
||||
|
||||
# These type variables are used by the container types.
|
||||
_S = TypeVar("_S")
|
||||
_KT = TypeVar("_KT") # Key type.
|
||||
@@ -368,7 +347,7 @@ def no_type_check(arg: _F) -> _F: ...
|
||||
def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ...
|
||||
|
||||
# This itself is only available during type checking
|
||||
def type_check_only(func_or_cls: _FT) -> _FT: ...
|
||||
def type_check_only(func_or_cls: _F) -> _F: ...
|
||||
|
||||
# Type aliases and type constructors
|
||||
|
||||
@@ -472,8 +451,7 @@ _YieldT_co = TypeVar("_YieldT_co", covariant=True)
|
||||
_SendT_contra = TypeVar("_SendT_contra", contravariant=True, default=None)
|
||||
_ReturnT_co = TypeVar("_ReturnT_co", covariant=True, default=None)
|
||||
|
||||
@runtime_checkable
|
||||
class Generator(Iterator[_YieldT_co], Protocol[_YieldT_co, _SendT_contra, _ReturnT_co]):
|
||||
class Generator(Iterator[_YieldT_co], Generic[_YieldT_co, _SendT_contra, _ReturnT_co]):
|
||||
def __next__(self) -> _YieldT_co: ...
|
||||
@abstractmethod
|
||||
def send(self, value: _SendT_contra, /) -> _YieldT_co: ...
|
||||
@@ -491,6 +469,14 @@ class Generator(Iterator[_YieldT_co], Protocol[_YieldT_co, _SendT_contra, _Retur
|
||||
def close(self) -> None: ...
|
||||
|
||||
def __iter__(self) -> Generator[_YieldT_co, _SendT_contra, _ReturnT_co]: ...
|
||||
@property
|
||||
def gi_code(self) -> CodeType: ...
|
||||
@property
|
||||
def gi_frame(self) -> FrameType: ...
|
||||
@property
|
||||
def gi_running(self) -> bool: ...
|
||||
@property
|
||||
def gi_yieldfrom(self) -> Generator[Any, Any, Any] | None: ...
|
||||
|
||||
# NOTE: Prior to Python 3.13 these aliases are lacking the second _ExitT_co parameter
|
||||
if sys.version_info >= (3, 13):
|
||||
@@ -516,7 +502,14 @@ _ReturnT_co_nd = TypeVar("_ReturnT_co_nd", covariant=True)
|
||||
class Coroutine(Awaitable[_ReturnT_co_nd], Generic[_YieldT_co, _SendT_contra_nd, _ReturnT_co_nd]):
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
|
||||
@property
|
||||
def cr_await(self) -> Any | None: ...
|
||||
@property
|
||||
def cr_code(self) -> CodeType: ...
|
||||
@property
|
||||
def cr_frame(self) -> FrameType | None: ...
|
||||
@property
|
||||
def cr_running(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def send(self, value: _SendT_contra_nd, /) -> _YieldT_co: ...
|
||||
@overload
|
||||
@@ -551,8 +544,7 @@ class AsyncIterator(AsyncIterable[_T_co], Protocol[_T_co]):
|
||||
def __anext__(self) -> Awaitable[_T_co]: ...
|
||||
def __aiter__(self) -> AsyncIterator[_T_co]: ...
|
||||
|
||||
@runtime_checkable
|
||||
class AsyncGenerator(AsyncIterator[_YieldT_co], Protocol[_YieldT_co, _SendT_contra]):
|
||||
class AsyncGenerator(AsyncIterator[_YieldT_co], Generic[_YieldT_co, _SendT_contra]):
|
||||
def __anext__(self) -> Coroutine[Any, Any, _YieldT_co]: ...
|
||||
@abstractmethod
|
||||
def asend(self, value: _SendT_contra, /) -> Coroutine[Any, Any, _YieldT_co]: ...
|
||||
@@ -567,6 +559,14 @@ class AsyncGenerator(AsyncIterator[_YieldT_co], Protocol[_YieldT_co, _SendT_cont
|
||||
self, typ: BaseException, val: None = None, tb: TracebackType | None = None, /
|
||||
) -> Coroutine[Any, Any, _YieldT_co]: ...
|
||||
def aclose(self) -> Coroutine[Any, Any, None]: ...
|
||||
@property
|
||||
def ag_await(self) -> Any: ...
|
||||
@property
|
||||
def ag_code(self) -> CodeType: ...
|
||||
@property
|
||||
def ag_frame(self) -> FrameType: ...
|
||||
@property
|
||||
def ag_running(self) -> bool: ...
|
||||
|
||||
@runtime_checkable
|
||||
class Container(Protocol[_T_co]):
|
||||
@@ -1039,7 +1039,9 @@ if sys.version_info >= (3, 12):
|
||||
def override(method: _F, /) -> _F: ...
|
||||
@final
|
||||
class TypeAliasType:
|
||||
def __new__(cls, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()) -> Self: ...
|
||||
def __init__(
|
||||
self, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()
|
||||
) -> None: ...
|
||||
@property
|
||||
def __value__(self) -> Any: ...
|
||||
@property
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# Since this module defines "Self" it is not recognized by Ruff as typing_extensions.Self
|
||||
# ruff: noqa: PYI034
|
||||
import abc
|
||||
import sys
|
||||
import typing
|
||||
@@ -50,6 +48,12 @@ from typing import ( # noqa: Y022,Y037,Y038,Y039
|
||||
Sequence as Sequence,
|
||||
Set as Set,
|
||||
Sized as Sized,
|
||||
SupportsAbs as SupportsAbs,
|
||||
SupportsBytes as SupportsBytes,
|
||||
SupportsComplex as SupportsComplex,
|
||||
SupportsFloat as SupportsFloat,
|
||||
SupportsInt as SupportsInt,
|
||||
SupportsRound as SupportsRound,
|
||||
Text as Text,
|
||||
TextIO as TextIO,
|
||||
Tuple as Tuple,
|
||||
@@ -186,7 +190,6 @@ __all__ = [
|
||||
_T = typing.TypeVar("_T")
|
||||
_F = typing.TypeVar("_F", bound=Callable[..., Any])
|
||||
_TC = typing.TypeVar("_TC", bound=type[object])
|
||||
_T_co = typing.TypeVar("_T_co", covariant=True) # Any type covariant containers.
|
||||
|
||||
class _Final: ... # This should be imported from typing but that breaks pytype
|
||||
|
||||
@@ -279,6 +282,11 @@ def get_origin(tp: Any) -> Any | None: ...
|
||||
Annotated: _SpecialForm
|
||||
_AnnotatedAlias: Any # undocumented
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
# New and changed things in 3.10
|
||||
if sys.version_info >= (3, 10):
|
||||
from typing import (
|
||||
@@ -375,17 +383,7 @@ else:
|
||||
if sys.version_info >= (3, 12):
|
||||
from collections.abc import Buffer as Buffer
|
||||
from types import get_original_bases as get_original_bases
|
||||
from typing import (
|
||||
SupportsAbs as SupportsAbs,
|
||||
SupportsBytes as SupportsBytes,
|
||||
SupportsComplex as SupportsComplex,
|
||||
SupportsFloat as SupportsFloat,
|
||||
SupportsIndex as SupportsIndex,
|
||||
SupportsInt as SupportsInt,
|
||||
SupportsRound as SupportsRound,
|
||||
TypeAliasType as TypeAliasType,
|
||||
override as override,
|
||||
)
|
||||
from typing import TypeAliasType as TypeAliasType, override as override
|
||||
else:
|
||||
def override(arg: _F, /) -> _F: ...
|
||||
def get_original_bases(cls: type, /) -> tuple[Any, ...]: ...
|
||||
@@ -420,45 +418,6 @@ else:
|
||||
# https://github.com/python/typeshed/issues/10224 for why we're defining it this way
|
||||
def __buffer__(self, flags: int, /) -> memoryview: ...
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsInt(Protocol, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def __int__(self) -> int: ...
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsFloat(Protocol, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def __float__(self) -> float: ...
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsComplex(Protocol, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def __complex__(self) -> complex: ...
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsBytes(Protocol, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def __bytes__(self) -> bytes: ...
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsAbs(Protocol[_T_co]):
|
||||
@abc.abstractmethod
|
||||
def __abs__(self) -> _T_co: ...
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsRound(Protocol[_T_co]):
|
||||
@overload
|
||||
@abc.abstractmethod
|
||||
def __round__(self) -> int: ...
|
||||
@overload
|
||||
@abc.abstractmethod
|
||||
def __round__(self, ndigits: int, /) -> _T_co: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
from types import CapsuleType as CapsuleType
|
||||
from typing import (
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, Sequence
|
||||
from contextlib import _GeneratorContextManager
|
||||
from types import TracebackType
|
||||
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload
|
||||
from typing import Any, Final, Generic, Literal, TypeVar, overload
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -85,7 +85,6 @@ class _Call(tuple[Any, ...]):
|
||||
two: bool = False,
|
||||
from_kall: bool = True,
|
||||
) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, value: object, /) -> bool: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> _Call: ...
|
||||
@@ -404,7 +403,6 @@ class MagicProxy(Base):
|
||||
class _ANY:
|
||||
def __eq__(self, other: object) -> Literal[True]: ...
|
||||
def __ne__(self, other: object) -> Literal[False]: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
ANY: Any
|
||||
|
||||
|
||||
@@ -6,22 +6,21 @@ from _typeshed import SupportsFlush, SupportsWrite
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import Any, Generic, Protocol, TypeVar
|
||||
from typing_extensions import Never, TypeAlias
|
||||
from warnings import _ActionKind
|
||||
|
||||
_ResultClassType: TypeAlias = Callable[[_TextTestStream, bool, int], TextTestResult[Any]]
|
||||
_ResultClassType: TypeAlias = Callable[[_TextTestStream, bool, int], TextTestResult]
|
||||
|
||||
class _SupportsWriteAndFlush(SupportsWrite[str], SupportsFlush, Protocol): ...
|
||||
|
||||
# All methods used by unittest.runner.TextTestResult's stream
|
||||
class _TextTestStream(_SupportsWriteAndFlush, Protocol):
|
||||
def writeln(self, arg: str | None = None, /) -> None: ...
|
||||
def writeln(self, arg: str | None = None, /) -> str: ...
|
||||
|
||||
# _WritelnDecorator should have all the same attrs as its stream param.
|
||||
# But that's not feasible to do Generically
|
||||
# We can expand the attributes if requested
|
||||
class _WritelnDecorator:
|
||||
def __init__(self, stream: _SupportsWriteAndFlush) -> None: ...
|
||||
def writeln(self, arg: str | None = None) -> None: ...
|
||||
def __init__(self, stream: _TextTestStream) -> None: ...
|
||||
def writeln(self, arg: str | None = None) -> str: ...
|
||||
def __getattr__(self, attr: str) -> Any: ... # Any attribute from the stream type passed to __init__
|
||||
# These attributes are prevented by __getattr__
|
||||
stream: Never
|
||||
@@ -40,8 +39,10 @@ class TextTestResult(unittest.result.TestResult, Generic[_StreamT]):
|
||||
showAll: bool # undocumented
|
||||
stream: _StreamT # undocumented
|
||||
if sys.version_info >= (3, 12):
|
||||
durations: int | None
|
||||
def __init__(self, stream: _StreamT, descriptions: bool, verbosity: int, *, durations: int | None = None) -> None: ...
|
||||
durations: unittest.result._DurationsType | None
|
||||
def __init__(
|
||||
self, stream: _StreamT, descriptions: bool, verbosity: int, *, durations: unittest.result._DurationsType | None = None
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self, stream: _StreamT, descriptions: bool, verbosity: int) -> None: ...
|
||||
|
||||
@@ -55,11 +56,11 @@ class TextTestRunner:
|
||||
verbosity: int
|
||||
failfast: bool
|
||||
buffer: bool
|
||||
warnings: _ActionKind | None
|
||||
warnings: str | None
|
||||
tb_locals: bool
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
durations: int | None
|
||||
durations: unittest.result._DurationsType | None
|
||||
def __init__(
|
||||
self,
|
||||
stream: _SupportsWriteAndFlush | None = None,
|
||||
@@ -68,10 +69,10 @@ class TextTestRunner:
|
||||
failfast: bool = False,
|
||||
buffer: bool = False,
|
||||
resultclass: _ResultClassType | None = None,
|
||||
warnings: _ActionKind | None = None,
|
||||
warnings: str | None = None,
|
||||
*,
|
||||
tb_locals: bool = False,
|
||||
durations: int | None = None,
|
||||
durations: unittest.result._DurationsType | None = None,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import unittest.case
|
||||
import unittest.result
|
||||
from collections.abc import Iterable, Iterator
|
||||
from typing import ClassVar
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_TestType: TypeAlias = unittest.case.TestCase | TestSuite
|
||||
@@ -18,7 +17,6 @@ class BaseTestSuite:
|
||||
def countTestCases(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_TestType]: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class TestSuite(BaseTestSuite):
|
||||
def run(self, result: unittest.result.TestResult, debug: bool = False) -> unittest.result.TestResult: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ from _typeshed import SupportsKeysAndGetItem
|
||||
from _weakref import getweakrefcount as getweakrefcount, getweakrefs as getweakrefs, proxy as proxy
|
||||
from _weakrefset import WeakSet as WeakSet
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping
|
||||
from typing import Any, ClassVar, Generic, TypeVar, final, overload
|
||||
from typing import Any, Generic, TypeVar, final, overload
|
||||
from typing_extensions import ParamSpec, Self
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -47,13 +47,11 @@ class CallableProxyType(Generic[_CallableT]): # "weakcallableproxy"
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
__call__: _CallableT
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
@final
|
||||
class ProxyType(Generic[_T]): # "weakproxy"
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class ReferenceType(Generic[_T]): # "weakref"
|
||||
__callback__: Callable[[Self], Any]
|
||||
@@ -117,12 +115,6 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
|
||||
def pop(self, key: _KT, default: _VT) -> _VT: ...
|
||||
@overload
|
||||
def pop(self, key: _KT, default: _T) -> _VT | _T: ...
|
||||
@overload
|
||||
def update(self, other: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self, other: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self, other: None = None, /, **kwargs: _VT) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __or__(self, other: Mapping[_T1, _T2]) -> WeakValueDictionary[_KT | _T1, _VT | _T2]: ...
|
||||
def __ror__(self, other: Mapping[_T1, _T2]) -> WeakValueDictionary[_KT | _T1, _VT | _T2]: ...
|
||||
@@ -171,12 +163,6 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
|
||||
def pop(self, key: _KT, default: _VT) -> _VT: ...
|
||||
@overload
|
||||
def pop(self, key: _KT, default: _T) -> _VT | _T: ...
|
||||
@overload
|
||||
def update(self, dict: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self, dict: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self, dict: None = None, /, **kwargs: _VT) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __or__(self, other: Mapping[_T1, _T2]) -> WeakKeyDictionary[_KT | _T1, _VT | _T2]: ...
|
||||
def __ror__(self, other: Mapping[_T1, _T2]) -> WeakKeyDictionary[_KT | _T1, _VT | _T2]: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
import xml.dom
|
||||
from _typeshed import Incomplete, ReadableBuffer, SupportsRead, SupportsWrite
|
||||
from typing import ClassVar, Literal, NoReturn, TypeVar, overload
|
||||
from typing import Literal, NoReturn, TypeVar, overload
|
||||
from typing_extensions import Self
|
||||
from xml.dom.minicompat import NodeList
|
||||
from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS
|
||||
@@ -151,7 +151,6 @@ class NamedNodeMap:
|
||||
def keysNS(self): ...
|
||||
def values(self): ...
|
||||
def get(self, name: str, value: Incomplete | None = None): ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __len__(self) -> int: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ge__(self, other: NamedNodeMap) -> bool: ...
|
||||
|
||||
@@ -6,7 +6,7 @@ from collections.abc import Callable, Iterable, Mapping
|
||||
from datetime import datetime
|
||||
from io import BytesIO
|
||||
from types import TracebackType
|
||||
from typing import Any, ClassVar, Final, Literal, Protocol, overload
|
||||
from typing import Any, Final, Literal, Protocol, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
class _SupportsTimeTuple(Protocol):
|
||||
@@ -76,7 +76,6 @@ def _strftime(value: _XMLDate) -> str: ... # undocumented
|
||||
class DateTime:
|
||||
value: str # undocumented
|
||||
def __init__(self, value: int | str | datetime | time.struct_time | tuple[int, ...] = 0) -> None: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __lt__(self, other: _DateTimeComparable) -> bool: ...
|
||||
def __le__(self, other: _DateTimeComparable) -> bool: ...
|
||||
def __gt__(self, other: _DateTimeComparable) -> bool: ...
|
||||
@@ -96,7 +95,6 @@ class Binary:
|
||||
def decode(self, data: ReadableBuffer) -> None: ...
|
||||
def encode(self, out: SupportsWrite[str]) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
def _binary(data: ReadableBuffer) -> Binary: ... # undocumented
|
||||
|
||||
@@ -110,7 +108,8 @@ class ExpatParser: # undocumented
|
||||
_WriteCallback: TypeAlias = Callable[[str], object]
|
||||
|
||||
class Marshaller:
|
||||
dispatch: dict[type[_Marshallable] | Literal["_arbitrary_instance"], Callable[[Marshaller, Any, _WriteCallback], None]]
|
||||
# TODO: Replace 'Any' with some kind of binding
|
||||
dispatch: dict[type[Any], Callable[[Marshaller, Any, _WriteCallback], None]]
|
||||
memo: dict[Any, None]
|
||||
data: None
|
||||
encoding: str | None
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, ClassVar, final
|
||||
from typing import Any, final
|
||||
|
||||
class Str(str): ...
|
||||
|
||||
@@ -17,8 +17,6 @@ if sys.version_info >= (3, 10):
|
||||
|
||||
else:
|
||||
class error(Exception): ...
|
||||
|
||||
class Null:
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
class Null: ...
|
||||
|
||||
def roj(b: Any, /) -> None: ...
|
||||
|
||||
@@ -21,7 +21,7 @@ if sys.version_info >= (3, 9):
|
||||
class ZoneInfo(tzinfo):
|
||||
@property
|
||||
def key(self) -> str: ...
|
||||
def __new__(cls, key: str) -> Self: ...
|
||||
def __init__(self, key: str) -> None: ...
|
||||
@classmethod
|
||||
def no_cache(cls, key: str) -> Self: ...
|
||||
@classmethod
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user