diff --git a/ffi/README.md b/ffi/README.md index 405aea110..188849b46 100644 --- a/ffi/README.md +++ b/ffi/README.md @@ -789,7 +789,8 @@ caller imports it with no ignores. - **Objects** are classes owning their handle, freed once their last reference goes, which the caller's reference keeps through a call, so there is no `close()`. A `self` method, or passing the object by value, moves its value out, after which a call raises - `ValueError`. `Clone` is `clone()`, and `PartialEq` is `==`, unhashable unless the type implements `Hash`, which `hash()` hashes it by. A field is a + `ValueError`. `Clone` is `clone()`, and `PartialEq` is `==`, unhashable unless the type implements `Hash`, which `hash()` hashes it by. An object, as + an opaque value and a record, takes weak references (`weakref.ref`). A field is a property, `first_get`, and its setter a method, `first_set(value)`, named as the C ones, since setting an object moves it in and closes it, which an assignment would hide. - **Checks**: a borrow or move Rust's rules refuse raises, naming the function and the rule, @@ -800,10 +801,13 @@ caller imports it with no ignores. thread: on the next turn of the event loop that ran there when a call made a value that is not `Send`, though the loop calls nothing into Rust, else at its next call or as it exits. -- **Records** are slotted dataclasses, compared by their fields, a float by IEEE `==` even - against itself, as Rust does, and **enums** an `Enum` - of upper-case members, or for one with data a class of a dataclass per variant, - `Event.Moved(p)`. `Display` is `str()`, `Debug` `repr()`, and `Default` a static +- **Records** are slotted classes, written out as `@dataclass(slots=True, + weakref_slot=True)` would make them, so no `dataclass` runs at import: an `__init__` + taking each field, `__match_args__`, a dataclass's `repr`, and `__eq__` comparing the + fields, a float by IEEE `==` even against itself, as Rust does. `dataclasses.fields`, + `replace`, and `asdict` take one, as its `__dataclass_fields__` is made on its first read, + and so does `copy.replace`. **Enums** are an `Enum` of upper-case members, or for one + with data a class of such a record per variant, `Event.Moved(p)`. `Display` is `str()`, `Debug` `repr()`, and `Default` a static `default()`. Constants are module or class attributes, made anew on each read unless a literal. An **opaque value** is a class of the runtime's `Value`, which holds its bytes in place, so only Rust makes or reads one: making one raises `TypeError`. It is shared @@ -819,7 +823,11 @@ caller imports it with no ignores. raises `OverflowError` or `ValueError` passed in out of their range; its `from_timedelta` and `to_timedelta` raise rather than lose anything, as a `timedelta` holds only whole microseconds up to 999,999,999 days. A zero passed for a `NonZero` raises `ValueError`. A `Range` is a `range`, and an `Err` a raised `Exception` - holding it in `error`, whose `str` is its `Display`. A `[u8; N]` is a generated + holding it in `error`, whose `str` is its `Display`. An enum's, or an object's whose + type is an enum, raises a subclass per variant, `ErrorException.Timeout`, which + `ErrorException(error)` makes too, so `except ErrorException.Timeout` catches that + variant alone; one of a variant a `#[non_exhaustive]` enum's crate adds after the export + raises `ErrorException` itself. A `[u8; N]` is a generated `ArrayU8x`, a `bytes` that raises `ValueError` unless it holds exactly `N`; a parameter takes any `bytes` of `N`. - A **path** is a `str`, or any path passed in, which crosses as `os.fsencode` encodes it, so @@ -861,7 +869,8 @@ caller imports it with no ignores. to a socket the loop reads, without the GIL, or during a call on the loop's own thread, writes nothing and schedules the loop's dispatch once the call returns. Cancelling the task frees the future and loses nothing. The call polls it once before suspending, and a future is awaited once, - as a coroutine is. + as a coroutine is. Futures and wakers run on asyncio's event loop alone: an await or a + `Waker` where none runs, as under trio, raises `RuntimeError` saying so. - An **awaitable Python implements** is an `Awaitable[None]`, such as a coroutine, passed on a running event loop, where Rust's first poll runs it as a task. Rust dropping it cancels the task, or closes a coroutine it never started. One that raises, or that diff --git a/ffi/fixtures/api/src/lib.rs b/ffi/fixtures/api/src/lib.rs index 7fecb16ba..ad355e2e0 100644 --- a/ffi/fixtures/api/src/lib.rs +++ b/ffi/fixtures/api/src/lib.rs @@ -4454,6 +4454,42 @@ pub fn refuse(reason: &str) -> Result> { })) } +/// Why [`jam`] failed: an enum whose own `Drop` makes it an object, whose variants a +/// binding still tells apart, as Python raises each as its own subclass. +#[derive(Debug)] +pub enum Fault { + /// Nothing is free. + Busy, + /// What was sent is lost. + Lost(String), + /// Too late, by this many. + Late { by: u32 }, +} + +impl Drop for Fault { + fn drop(&mut self) {} +} + +impl fmt::Display for Fault { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Fault::Busy => write!(f, "busy"), + Fault::Lost(what) => write!(f, "lost {what}"), + Fault::Late { by } => write!(f, "late by {by}"), + } + } +} + +/// Fails with the fault `n` picks: busy, lost, or late, and for any other `n`, returns it. +pub fn jam(n: u32) -> Result { + match n { + 0 => Err(Fault::Busy), + 1 => Err(Fault::Lost("frame".to_string())), + 2 => Err(Fault::Late { by: 7 }), + n => Ok(n), + } +} + /// The kind of target the library was built for. One binding serves the host and wasm32, /// so it has every target's variants, and a target refuses one it lacks. As wasm32's comes /// first, `Native`'s Rust discriminant differs between the two, which its C tag does not. diff --git a/ffi/runtime/python.rs b/ffi/runtime/python.rs index 06a8a9239..6142d5c02 100644 --- a/ffi/runtime/python.rs +++ b/ffi/runtime/python.rs @@ -1112,6 +1112,8 @@ pub fn array_out(items: &[u8], index: usize) -> R { #[repr(C)] struct ValueHead { ob_base: PyVarObject, + /// The weak references to it, which `weakref` keeps. + weaklist: *mut PyObject, /// The class registered at this index made it: Python can reassign `__class__`, to /// any class of `Value`'s layout, whose bytes may be fewer or another type's. index: usize, @@ -1142,6 +1144,7 @@ pub fn value_out(index: usize, value: T) -> R { unsafe { let alloc: allocfunc = std::mem::transmute(PyType_GetSlot(class.cast(), Py_tp_alloc)); let obj = Obj::new(alloc(class.cast(), size_of::() as Py_ssize_t))?; + (*obj.ptr().cast::()).weaklist = null_mut(); (*obj.ptr().cast::()).index = index; obj.ptr().cast::().add(size_of::()).cast::().write_unaligned(value); Ok(obj) @@ -1610,13 +1613,14 @@ pub fn member_in(obj: *mut PyObject, index: usize) -> R { } } -/// Raise the exception class registered at `index`, holding `error`. +/// Raise the exception class registered at `index`, holding `error`: the subclass of its +/// variant, for an enum's, which the class makes. pub fn raise_error(index: usize, error: R) -> R { let args = tuple(vec![error])?; // SAFETY: the GIL is held, and the class an exception's. unsafe { let exc = Obj::new(PyObject_CallObject(ty(index), args.ptr()))?; - PyErr_SetObject(ty(index), exc.ptr()); + PyErr_SetObject(Py_TYPE(exc.ptr()).cast(), exc.ptr()); } Err(Raised) } @@ -1846,6 +1850,8 @@ pub unsafe extern "C" fn free_callback(data: *mut c_void) { #[repr(C)] pub struct Handle { ob_base: PyObject, + /// The weak references to it, which `weakref` keeps. + weaklist: *mut PyObject, /// The class registered at this index made it: Python can reassign `__class__`. index: usize, raw: *const c_void, @@ -1890,6 +1896,7 @@ fn handle(raw: *const c_void, index: usize, free: Option(); + (*handle).weaklist = null_mut(); (*handle).index = index; (*handle).raw = raw; (*handle).free = free; @@ -1969,11 +1976,56 @@ unsafe fn free_now(handle: *mut Handle) { unsafe extern "C" fn handle_dealloc(obj: *mut PyObject) { // SAFETY: Python deallocates an `Object` once, holding the GIL; nothing holds it. unsafe { + clear_weak(obj, (*obj.cast::()).weaklist); free_now(obj.cast()); dealloc(obj); } } +unsafe extern "C" fn value_dealloc(obj: *mut PyObject) { + // SAFETY: Python deallocates a `Value` once, holding the GIL. + unsafe { + clear_weak(obj, (*obj.cast::()).weaklist); + dealloc(obj); + } +} + +/// Clear the weak references to `obj`, as its dealloc must: Python's `subtype_dealloc` +/// leaves them to it, for a class of `Object` or `Value` is not tracked by the collector. +/// +/// # Safety +/// `obj` is being deallocated, holding the GIL, and `weaklist` is its list. +unsafe fn clear_weak(obj: *mut PyObject, weaklist: *mut PyObject) { + if !weaklist.is_null() { + // SAFETY: the caller's contract. + unsafe { PyObject_ClearWeakRefs(obj) }; + } +} + +/// The members of a type whose instances hold a list of weak references at `offset`: +/// `__weaklistoffset__` alone, which `PyType_FromSpec` reads to let `weakref` take them. +const fn weak_members(offset: usize) -> [PyMemberDef; 2] { + [ + PyMemberDef { + name: c"__weaklistoffset__".as_ptr(), + type_code: Py_T_PYSSIZET, + offset: offset as Py_ssize_t, + flags: Py_READONLY, + doc: null(), + }, + PyMemberDef { + name: null(), + type_code: 0, + offset: 0, + flags: 0, + doc: null(), + }, + ] +} + +static OBJECT_MEMBERS: Gil<[PyMemberDef; 2]> = Gil::new(weak_members(std::mem::offset_of!(Handle, weaklist))); +static VALUE_MEMBERS: Gil<[PyMemberDef; 2]> = Gil::new(weak_members(std::mem::offset_of!(ValueHead, weaklist))); + /// Free an instance of a heap type, and the reference to its type it held. /// /// # Safety @@ -2977,6 +3029,7 @@ unsafe fn runtime(module: *mut PyObject) -> R<()> { let base = (Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION) as u64; add_type(module, &OBJECT, c"Object", size_of::(), base, &mut [ slot(Py_tp_dealloc, handle_dealloc as *mut c_void), + slot(Py_tp_members, OBJECT_MEMBERS.get().as_mut_ptr().cast()), slot( Py_tp_doc, c"An object owning a Rust value's handle, freed once the last reference to it goes.".as_ptr().cast_mut().cast(), @@ -2985,6 +3038,8 @@ unsafe fn runtime(module: *mut PyObject) -> R<()> { ])?; // Its items are a value's bytes, past the header. add_sized(module, &VALUE_BASE, c"Value", size_of::(), 1, base, &mut [ + slot(Py_tp_dealloc, value_dealloc as *mut c_void), + slot(Py_tp_members, VALUE_MEMBERS.get().as_mut_ptr().cast()), slot( Py_tp_doc, c"A Rust `Copy` value's bytes, which only Rust makes or reads.".as_ptr().cast_mut().cast(), diff --git a/ffi/runtime/rt.py b/ffi/runtime/rt.py index a3ce4f64f..40b8d1665 100644 --- a/ffi/runtime/rt.py +++ b/ffi/runtime/rt.py @@ -1,7 +1,8 @@ # The runtime every generated Python module includes: the awaitable a future that pends # is, the queue each event loop reads its wakes from, `Waker`, what runs an awaitable Rust -# polls, `Mut`, `ForeignReader`, and `Duration`. Its names start with `_` but `Waker`, -# `Mut`, `ForeignReader`, and `Duration`, so no exported name clashes with them. +# polls, `Mut`, `ForeignReader`, `Duration`, and what each record shares. Its names start +# with `_` but `Waker`, `Mut`, `ForeignReader`, and `Duration`, so no exported name clashes +# with them. class _Future(_n.Future, _typing.Generic[_T]): @@ -231,3 +232,58 @@ def __init__(self, get: _typing.Callable[[], _object]) -> None: def __get__(self, obj: _object, cls: _object = None) -> _object: return self.get() + + +class _Dataclass: + """A record class's `__dataclass_fields__` or `__dataclass_params__`, which `dataclasses` + makes on the first read of either, so `dataclasses` takes a record, or a subclass of + one, as the dataclass it was, while no record pays for `dataclasses` at import.""" + + __slots__ = ("name",) + + def __init__(self, name: _str) -> None: + self.name = name + + def __get__(self, obj: _object, cls: _type[_Record]) -> _object: + import dataclasses + + # The record that declares the fields, which a subclass of it inherits. It is the first + # this module made, as a subclass made elsewhere may set its own `__match_args__`. + owner: _typing.Any = _Record + for c in cls.__mro__: + if c.__module__ == _Record.__module__ and "__match_args__" in c.__dict__: + owner = c + break + hints = owner.__annotations__ + shape: _typing.Any = _type(owner.__name__, (), {"__annotations__": {name: hints[name] for name in owner.__match_args__}}) + shape = dataclasses.dataclass(shape, slots=True, weakref_slot=True) + made = {name: _getattr(shape, name) for name in ("__dataclass_fields__", "__dataclass_params__")} + # `_Record`'s own stay, as each record reads them. + if owner is not _Record: + for name, value in made.items(): + _type.__setattr__(owner, name, value) + return made[self.name] + + +class _Record: + """What each record shares besides the `__init__` and `__eq__` it writes out as a + dataclass would: a dataclass's `repr`, `__dataclass_fields__`, `__dataclass_params__`, + and `__replace__`.""" + + __slots__ = () + + __match_args__: _typing.ClassVar[_tuple[_str, ...]] = () + if _typing.TYPE_CHECKING: + __dataclass_fields__: _typing.ClassVar[_dict[_str, _dataclasses.Field[_typing.Any]]] + else: + __dataclass_fields__ = _Dataclass("__dataclass_fields__") + __dataclass_params__ = _Dataclass("__dataclass_params__") + + def __repr__(self) -> _str: + fields = ", ".join(f"{name}={_getattr(self, name)!r}" for name in self.__match_args__) + return f"{_type(self).__qualname__}({fields})" + + def __replace__(self, /, **changes: _object) -> _typing.Self: + import dataclasses + + return dataclasses.replace(self, **changes) diff --git a/ffi/src/collect.rs b/ffi/src/collect.rs index 15505d2d0..bdb1c138b 100644 --- a/ffi/src/collect.rs +++ b/ffi/src/collect.rs @@ -1732,6 +1732,7 @@ impl<'tcx> Collector<'tcx> { lifetimes, methods: Vec::new(), traits: Traits::default(), + variants: Vec::new(), foreign: false, opaque: None, }); @@ -1881,6 +1882,7 @@ impl<'tcx> Collector<'tcx> { clone: !owned, ..Traits::default() }, + variants: Vec::new(), foreign: true, opaque: Some(match owned { true => Held::Value, @@ -2016,6 +2018,7 @@ impl<'tcx> Collector<'tcx> { lifetimes: 0, methods, traits, + variants: Vec::new(), foreign: true, opaque: None, } @@ -2434,6 +2437,17 @@ impl<'tcx> Collector<'tcx> { object.methods = methods; object.traits = traits; object.shared = shared && object.sync; + if kind == DefKind::Enum && object.opaque.is_none() { + object.variants = (tcx.adt_def(def_id).variants().iter()) + .map(|v| Variant { + name: v.name.to_string(), + discriminant: 0, + fields: Vec::new(), + tuple: false, + on: On::ALL, + }) + .collect(); + } } _ => {} } diff --git a/ffi/src/glue.rs b/ffi/src/glue.rs index 73cbe6779..bed53f3da 100644 --- a/ffi/src/glue.rs +++ b/ffi/src/glue.rs @@ -430,6 +430,7 @@ impl Crate<'_> { checking: Cell::new(false), reserved: Cell::new(false), web: web.is_some(), + variants: String::new(), }; generator.lib(); output.file(&out.join("Cargo.toml"), &manifest("0.0.0")); @@ -637,6 +638,8 @@ struct Gen<'a> { reserved: Cell, /// Whether the API serves the web, whose glue the crate's `web` feature builds. web: bool, + /// The Python glue's functions telling which variant an object that is an enum holds. + variants: String, } impl Gen<'_> { @@ -1498,6 +1501,12 @@ impl Gen<'_> { for function in &api.functions { self.function(function, None); } + if !self.variants.is_empty() { + let variants = crate::kotlin::indent_by(&std::mem::take(&mut self.variants), 1); + self.line(format!( + "/// Which variant each object that is an enum holds, for the Python glue, which raises an\n/// error's own subclass by it.\n#[cfg(feature = \"python\")]\npub(crate) mod variant {{\n\tuse super::*;\n\n{variants}}}\n" + )); + } } /// The functions object `i`'s std traits export, borrowing its handles `this`, `a`, @@ -1575,6 +1584,31 @@ impl Gen<'_> { "#[unsafe(no_mangle)]\npub unsafe extern \"C\" fn {name}_to_string(this: {handle}{param}) -> rt::Buf {{\n\tlet w = \"{name}_to_string\";\n\t{away}{body}\n}}\n" )); } + let variants = &self.abi.api.objects[i].variants; + if !variants.is_empty() { + // Each variant by its index plus one, or `0` for one the export knows no name of, + // as a `#[non_exhaustive]` enum's own crate may add. + let arms: String = (variants.iter().enumerate()) + .map(|(n, v)| format!("{}\n\t\tT::{} {{ .. }} => {},", self.arm(v.on), ident(&v.name), n + 1)) + .collect(); + let body = wrap( + status, + "u32", + &format!("let this = {this};\n\tmatch {deref}this {{{arms}\n\t\t_ => 0,\n\t}}"), + ); + let away = away(&name, &["this"]); + let function = format!( + "#[allow(unreachable_patterns, reason = \"an exhaustive enum's wildcard\")]\npub(crate) unsafe fn {name}(this: {handle}{param}) -> u32 {{\n\ttype T = {path};\n\tlet w = \"{name}_variant\";\n\t{away}{body}\n}}\n" + ); + let function = match self.cfg(self.on) { + None => function, + Some(cfg) => format!( + "#[cfg({cfg})]\n{function}#[cfg(not({cfg}))]\n#[allow(unused_variables, reason = \"a call fails before reading any\")]\npub(crate) unsafe fn {name}(this: {handle}{param}) -> u32 {{\n\trt::fail(\"{name}_variant\", \"it is not on this library's target\")\n}}\n" + ), + }; + self.variants.push_str(&function); + self.variants.push('\n'); + } if traits.debug { let body = wrap( status, diff --git a/ffi/src/ir.rs b/ffi/src/ir.rs index b72257f27..2376d9516 100644 --- a/ffi/src/ir.rs +++ b/ffi/src/ir.rs @@ -355,6 +355,11 @@ pub(crate) struct Object { pub(crate) lifetimes: usize, pub(crate) methods: Vec, pub(crate) traits: Traits, + /// The variants of the enum it is, by name alone, as none of their fields reaches the + /// API: Python raises a subclass per variant of an error. A baseline written before it + /// has none. + #[serde(default)] + pub(crate) variants: Vec, /// Whether it is a foreign type, such as `url::Url`, that the facade maps rather than /// exports: its path is the type's in its own crate, not in the facade. pub(crate) foreign: bool, diff --git a/ffi/src/lock.rs b/ffi/src/lock.rs index 5c4dca59b..fb80ee82e 100644 --- a/ffi/src/lock.rs +++ b/ffi/src/lock.rs @@ -685,6 +685,23 @@ fn changed(base: &Index<'_>, now: &Index<'_>, maps: &Maps, ours: &Item<'_>, thei } (Item::Object(i), Item::Object(j)) => { traits(b.objects[i].traits, n.objects[j].traits); + // A binding names an enum object's variants, as Python's exception subclasses. + for variant in &b.objects[i].variants { + let Some(other) = n.objects[j].variants.iter().find(|v| v.name == variant.name) else { + changes.push(format!("variant `{}` is removed", variant.name)); + continue; + }; + let lost: Vec<&str> = (b.named(variant.on).into_iter()) + .filter(|t| n.targets.iter().any(|n| n == t) && !n.named(other.on).contains(t)) + .collect(); + if !lost.is_empty() { + changes.push(format!( + "variant `{}` is no longer on {}", + variant.name, + lost.join(", ") + )); + } + } let mut ours = merge::bare_object(&b.objects[i]); maps.types(&mut ours.args); let mut theirs = merge::bare_object(&n.objects[j]); @@ -894,11 +911,73 @@ mod tests { } #[test] - fn tuple_c_rename_is_reported_once() { + fn enum_object_variant_removal_breaks() { + let variant = |name: &str| crate::ir::Variant { + name: name.into(), + discriminant: 0, + fields: vec![], + tuple: false, + on: On::ALL, + }; let mut base = api(); - base.objects.push(crate::ir::Object { - path: vec!["lock".into(), "A_B".into()], - shown: vec!["lock".into(), "A_B".into()], + base.objects.push(object("Fault")); + base.objects[0].variants = vec![variant("Busy"), variant("Lost")]; + base.functions[0].err = Some(Type::Object(0)); + let mut now = base.clone(); + now.objects[0].variants.push(variant("Late")); + assert!(breaks(&base, &now, "lock").is_empty(), "an added variant passes"); + now.objects[0].variants.remove(1); + let found = breaks(&base, &now, "lock"); + assert!( + found.iter().any(|b| b.what.contains("variant `Lost` is removed")), + "{:?}", + found.iter().map(|b| &b.what).collect::>() + ); + } + + #[test] + fn python_variant_rename_breaks() { + let variant = |name: &str| crate::ir::Variant { + name: name.into(), + discriminant: 0, + fields: vec![], + tuple: false, + on: On::ALL, + }; + let mut base = api(); + base.objects.push(object("Fault")); + base.objects[0].variants = vec![variant("FooBar")]; + base.functions[0].err = Some(Type::Object(0)); + let old = crate::python::generate(&Abi::new(&base, "lock"), "lock", 0).unwrap(); + assert_eq!(old.names["error Fault / variant FooBar"], "FaultException.FooBar"); + // `Foo_Bar` added first takes `FooBar`, which the kept variant had. + let mut now = base.clone(); + now.objects[0].variants.insert(0, variant("Foo_Bar")); + assert!( + breaks(&base, &now, "lock").is_empty(), + "an added variant passes structurally" + ); + let abi = Abi::new(&now, "lock"); + let new = crate::python::generate(&abi, "lock", 0).unwrap(); + let changes = name_breaks( + &BTreeMap::from([("Python".into(), old.names)]), + &BTreeMap::from([("Python".into(), new.names)]), + &base, + &abi, + ); + assert!( + changes.iter().any(|c| c + .what + .contains("`FaultException.FooBar` is now `FaultException.FooBar_`")), + "{:?}", + changes.iter().map(|c| &c.what).collect::>() + ); + } + + fn object(name: &str) -> crate::ir::Object { + crate::ir::Object { + path: vec!["lock".into(), name.into()], + shown: vec!["lock".into(), name.into()], home: Home { krate: "lock_a".into(), outside: 1, @@ -914,9 +993,16 @@ mod tests { lifetimes: 0, methods: vec![], traits: Traits::default(), + variants: vec![], foreign: false, opaque: None, - }); + } + } + + #[test] + fn tuple_c_rename_is_reported_once() { + let mut base = api(); + base.objects.push(object("A_B")); base.functions[0].ok = Type::Option(Box::new(Type::Tuple(vec![Type::Object(0), Type::Int(Int::U64)]))); let old = crate::swift::generate(&Abi::new(&base, "lock"), "lock", 0).unwrap(); let mut now = base.clone(); diff --git a/ffi/src/merge.rs b/ffi/src/merge.rs index 469a1a152..d64254157 100644 --- a/ffi/src/merge.rs +++ b/ffi/src/merge.rs @@ -93,6 +93,7 @@ fn mark(api: &mut Api, on: On) { } for object in &mut api.objects { object.on = on; + object.variants.iter_mut().for_each(|v| v.on = on); functions(&mut object.methods); } for callback in &mut api.callbacks { @@ -241,6 +242,7 @@ pub(crate) fn bare_object(o: &Object) -> Object { o.docs.clear(); o.on = On::ALL; o.methods.clear(); + o.variants.clear(); unleaf(&mut o.traits); }) } @@ -479,6 +481,21 @@ impl Merged { self.differ(what, (ours.on, ours.span), (object.on, object.span)); } self.api.objects[at].on.0 |= object.on.0; + // Each variant is on the targets it is, after the one it follows in theirs. + let mut after = 0; + for variant in object.variants { + let ours = &mut self.api.objects[at].variants; + match ours.iter().position(|v| v.name == variant.name) { + Some(found) => { + ours[found].on.0 |= variant.on.0; + after = found + 1; + } + None => { + ours.insert(after, variant); + after += 1; + } + } + } leaves(&mut self.api.objects[at].traits, object.traits); let methods = std::mem::take(&mut self.api.objects[at].methods); self.api.objects[at].methods = self.functions(methods, object.methods); diff --git a/ffi/src/python.rs b/ffi/src/python.rs index 57c6b6053..153ae1750 100644 --- a/ffi/src/python.rs +++ b/ffi/src/python.rs @@ -6,10 +6,10 @@ //! is `moq.TrackProducer`, and its method `moq_track_producer_append_group` is //! `TrackProducer.append_group`. A keyword, or a member Python gives every such class, //! takes a trailing `_`. An object is a class owning its handle, freed once its last -//! reference goes; a record a dataclass; an enum an `Enum`, or for -//! one with data a class with a dataclass per variant; a trait an abstract class; a -//! closure any callable; a reader a `ForeignReader`; a future an awaitable; an error an -//! exception. The runtime they +//! reference goes; a record a class written as a dataclass would make it; an enum an +//! `Enum`, or for one with data a class with such a record per variant; a trait an abstract +//! class; a closure any callable; a reader a `ForeignReader`; a future an awaitable; an +//! error an exception, with a subclass per variant of an enum. The runtime they //! share, [`runtime/rt.py`](../runtime/rt.py), holds the awaitable and the queue an event //! loop reads its wakes from; the glue's, [`runtime/python.rs`](../runtime/python.rs), //! the conversions and the types the extension defines. @@ -62,7 +62,12 @@ const TAKEN: &[&str] = &[ "_abc", "_array", "_asyncio", - "_dataclass", + "_dataclasses", + "_Record", + "_Dataclass", + "_NotImplemented", + "_RuntimeError", + "_getattr", "_same", "_all", "_any", @@ -207,7 +212,9 @@ pub(crate) fn generate(abi: &Abi<'_>, packages: &str, contract: u64) -> Result, packages: &str, contract: u64) -> Result, packages: &str, contract: u64) -> Result _asyncio.AbstractEventLoop:\n\ + \t\"\"\"The running asyncio event loop, which every future and `Waker` of this module runs on.\"\"\"\n\ + \ttry:\n\ + \t\treturn _asyncio.get_running_loop()\n\ + \texcept _RuntimeError:\n\ + \t\traise _RuntimeError(\"{p}'s futures and wakers run on a running asyncio event loop, and none is running: trio and other event loops are unsupported\") from None\n\n\n\ def _same(a: _object, b: _object, /) -> _bool:\n\ \t\"\"\"Whether a and b are equal as Rust's `==` compares them: never by identity, so a NaN\n\ \tequals nothing, while a list's, tuple's, or dict's own `==` takes an item as equal to itself.\"\"\"\n\ @@ -835,15 +849,148 @@ impl<'a> Gen<'a> { ); } for (name, ty) in &self.exceptions.clone() { - let py = self.py_ty(ty); + self.exception_class(name, ty); + } + } + + /// The exception class `name` of an error of type `ty`: for an enum's, or an object's + /// that is one, a subclass per variant, such as `ErrorException.Timeout`, which the + /// class makes of a value of that variant. + fn exception_class(&mut self, name: &str, ty: &Type) { + let py = self.py_ty(ty); + let abi = self.abi; + let key = crate::lock::error_key(abi, ty); + let ty = strip_box(&strip_refs(ty)); + // The Rust type, its variants' names, how `__new__` picks the subclass of `error`, and + // what the class declares for type checkers besides each subclass. + let (rust, variants, pick, declared) = match ty { + Type::Enum(i) if !abi.api.enums[i].variants.is_empty() => { + let e = &abi.api.enums[i]; + // By what tells a variant apart: a plain enum's member, or the class of a + // variant of one with data. + let key = match e.plain() { + true => "error", + false => "_type(error)", + }; + let names: Vec<&str> = e.variants.iter().map(|v| v.name.as_str()).collect(); + let pick = format!("_{name}_variants.get({key}, cls)"); + (abi.api.rust(&e.path, &e.args), names, pick, String::new()) + } + Type::Object(i) if !abi.api.objects[i].variants.is_empty() => { + let object = &abi.api.objects[i]; + let declared = self.variant(i, name, &py); + let names: Vec<&str> = object.variants.iter().map(|v| v.name.as_str()).collect(); + let pick = format!("_{name}_variants[{name}._variant(error)]"); + (abi.api.rust(&object.path, &object.args), names, pick, declared) + } + _ => { + let _ = write!( + self.py, + "class {name}(_Exception):\n\t\"\"\"A `{py}` Rust returned as an error, in `error`, whose `str` is the exception's.\"\"\"\n\n\tdef __init__(self, error: {py}) -> None:\n\t\t_Exception.__init__(self, error)\n\t\tself.error = error\n\n\tdef __str__(self) -> _str:\n\t\treturn _str(self.error)\n\n\n" + ); + return; + } + }; + let vnames = variant_classes(variants.iter().copied()); + // Kept apart by order, a subclass's name is locked, so a variant added before one + // whose name it takes breaks the baseline. + for (variant, vname) in variants.iter().zip(&vnames) { + self.locked + .insert(format!("{key} / variant {variant}"), format!("{name}.{vname}")); + } + let aliases: String = (vnames.iter()) + .map(|v| format!("\t\t{v}: _typing.TypeAlias = \"_{name}_{v}\"\n")) + .collect(); + let _ = write!( + self.py, + "class {name}(_Exception):\n\t\"\"\"A `{py}` Rust returned as an error, in `error`, whose `str` is the exception's.\n\n\tEach variant raises its own subclass, such as `{name}.{}`, which `{name}(error)`\n\tmakes too.\"\"\"\n\n\tdef __new__(cls, error: {py}) -> _typing.Self:\n\t\tvariant = {pick} if cls is {name} else cls\n\t\treturn _typing.cast(_typing.Self, _Exception.__new__(variant, error))\n\n\tdef __init__(self, error: {py}) -> None:\n\t\t_Exception.__init__(self, error)\n\t\tself.error = error\n\n\tdef __str__(self) -> _str:\n\t\treturn _str(self.error)\n\n\tif _typing.TYPE_CHECKING:\n{declared}{aliases}\n\n", + vnames[0] + ); + for (vname, variant) in vnames.iter().zip(&variants) { + let class = format!("_{name}_{vname}"); let _ = write!( self.py, - "class {name}(_Exception):\n\t\"\"\"A `{py}` Rust returned as an error, in `error`, whose `str` is the exception's.\"\"\"\n\n\tdef __init__(self, error: {py}) -> None:\n\t\t_Exception.__init__(self, error)\n\t\tself.error = error\n\n\tdef __str__(self) -> _str:\n\t\treturn _str(self.error)\n\n\n" + "class {class}({name}):\n\t\"\"\"`{rust}::{variant}` Rust returned as an error.\"\"\"\n\n\n{class}.__name__ = \"{vname}\"\n{class}.__qualname__ = \"{name}.{vname}\"\nif not _typing.TYPE_CHECKING:\n\t{name}.{vname} = {class}\n\n\n" ); } + let classes: Vec = vnames.iter().map(|v| format!("\t_{name}_{v},\n")).collect(); + let _ = match ty { + // An object's variant is its index plus one, or `0` for one the export knows no + // name of, which raises the class itself. + Type::Object(_) => write!( + self.py, + "_{name}_variants: _tuple[_type[{name}], ...] = (\n\t{name},\n{})\n\n\n", + classes.concat() + ), + _ => { + let e = match ty { + Type::Enum(i) => &abi.api.enums[i], + _ => unreachable!("an enum"), + }; + let entries: Vec = (e.variants.iter().zip(&vnames)) + .map(|(v, vname)| match e.plain() { + true => format!("\t{py}.{}: _{name}_{vname},\n", abi::snake(&v.name).to_uppercase()), + false => format!("\t_{py}_{vname}: _{name}_{vname},\n"), + }) + .collect(); + let by = match e.plain() { + true => py.clone(), + false => format!("_type[{py}]"), + }; + write!( + self.py, + "_{name}_variants: _dict[{by}, _type[{name}]] = {{\n{}}}\n\n\n", + entries.concat() + ) + } + }; + } + + /// The static method `_variant` of the exception class `name` of object `i`'s errors, + /// of Python type `py`, telling which variant one holds by its index plus one, or `0` + /// for one the export knows no name of; returning its declaration, for type checkers. + /// No Rust name reaches the exception class, so none clashes with it. + fn variant(&mut self, i: usize, name: &str, py: &str) -> String { + let ty = Type::Object(i); + let c = self.abi.object(i); + let bare = format!("{}_variant", self.bare(&c)); + let on = std::mem::replace(&mut self.on, self.abi.api.objects[i].on); + let this = self.lift( + &Type::Ref(crate::ir::Mutability::Not, Box::new(ty.clone())), + "a[0]", + "false", + ); + let (status, arg, check) = match self.abi.traits_status_of(&ty) { + true => ( + "let mut status = 0;\n\t\t", + ", &mut status", + format!("\n\t\ts.status(status, \"{c}_variant\")?;"), + ), + false => ("", "", String::new()), + }; + let body = self.checked( + &bare, + &format!( + "let this = {this}?;\n\t\t{status}let ret = rt::call(|| crate::variant::{c}(this{arg}));{check}\n\t\ts.done();\n\t\trt::uint_out(ret as u64)" + ), + ); + let _ = write!( + self.glue, + "unsafe extern \"C\" fn variant_{c}(_: *mut PyObject, a: *const *mut PyObject, n: Py_ssize_t, kw: *mut PyObject) -> *mut PyObject {{\n\trt::wrap(|| unsafe {{\n\t\tlet a = rt::params::<1>(None, a, n, kw, &[\"error\"], \"{name}._variant\")?;\n\t\tlet s = &mut rt::Scope::default();\n\t\t{body}\n\t}})\n}}\n\n" + ); + let docs = "Which variant `error` holds, by its index plus one, or `0` for one no name is known of."; + let doc = c_str(&format!("_variant(error)\n--\n\n{docs}")); + let t = self.t(&format!("exc_{name}")); + self.members.push(format!( + "rt::Member::Static({t}, rt::function(c\"_variant\", {doc}, variant_{c}))" + )); + self.on = on; + format!( + "\t\t@_staticmethod\n\t\tdef _variant(error: {py}, /) -> _int:\n\t\t\t\"\"\"{docs}\"\"\"\n\t\t\t...\n\n" + ) } - /// A range's bound or pair of bounds as a dataclass, and its glue; a `Range` is + /// A range's bound or pair of bounds as a record, and its glue; a `Range` is /// Python's `range`. fn range(&mut self, c: &str, ty: &Type) { let name = self.class(c); @@ -854,7 +1001,7 @@ impl<'a> Gen<'a> { let (kind, value) = (self.key("kind"), self.key("value")); let t_bound = self.t(&bound); ( - "\tkind: Bound\n\tvalue: _int\n".to_string(), + vec![("kind", "Bound".to_string()), ("value", "_int".to_string())], format!( "let k = rt::field(o, {t}, {kind}, s)?;\n\tlet v = rt::attr(o, {value}, s)?;\n\tOk(crate::{c} {{ kind: rt::member_in(k, {t_bound})?, value: rt::int_in::<{r}>(v)? }})", t = self.t(c), @@ -872,7 +1019,7 @@ impl<'a> Gen<'a> { let (start, end) = (self.key("start"), self.key("end")); let class = self.class(&bound); ( - format!("\tstart: {class}\n\tend: {class}\n"), + vec![("start", class.clone()), ("end", class)], format!( "let a = rt::field(o, {t}, {start}, s)?;\n\tlet b = rt::attr(o, {end}, s)?;\n\tOk(crate::{c} {{ start: r_{bound}(a, s)?, end: r_{bound}(b, s)? }})", t = self.t(c) @@ -886,7 +1033,15 @@ impl<'a> Gen<'a> { other => unreachable!("{other:?} is no range"), }; self.register(c, name.clone()); - let _ = write!(self.py, "@_dataclass(slots=True)\nclass {name}:\n{fields}\n\n"); + let fields: Vec = (fields.into_iter()) + .map(|(name, ty)| Slot { + name: name.to_string(), + ty, + docs: String::new(), + same: false, + }) + .collect(); + let _ = write!(self.py, "{}\n\n", record_class(&name, "_Record", "", &fields, &[])); let _ = write!( self.glue, "fn r_{c}(o: *mut PyObject, s: &mut rt::Scope) -> R {{\n\t{read}\n}}\n\nfn w_{c}(v: crate::{c}) -> R {{\n\t{write}\n}}\n\n" @@ -1010,8 +1165,8 @@ impl<'a> Gen<'a> { "\tdef clone(self) -> {class}:\n\t\t\"\"\"{docs}\"\"\"\n\t\t...\n" )); } - // An opaque value compares through Rust, as an object does; a record's fields - // compare as a dataclass's. + // An opaque value compares through Rust, as an object does; a record compares its + // fields, as `record_class` writes. if (object || opaque) && t.eq { let other = match object { true => self.lift( @@ -1132,9 +1287,6 @@ impl<'a> Gen<'a> { let owner = Ty::Struct(c.clone()); let data: Vec = record.fields.iter().map(|f| field_name(&f.name)).collect(); self.methods(&record.methods, (&ty, &owner, &rust), &data, &[], &mut body); - if record.fields.iter().any(|f| own_eq(abi, &f.ty)) { - body.python.push(ieee_eq(&name, &data)); - } if record.opaque.is_some() { let text = format!( "{rust}\n\n{}\n\nIts bytes, which only Rust makes or reads: copy it, but never make one.", @@ -1152,27 +1304,19 @@ impl<'a> Gen<'a> { ); return; } - let fields: String = record - .fields - .iter() - .map(|f| { - format!( - "\t{}: {}\n{}", - field_name(&f.name), - self.py_field(&f.ty), - docstring(&f.docs, "\t") - ) + let fields: Vec = (record.fields.iter()) + .map(|f| Slot { + name: field_name(&f.name), + ty: self.py_field(&f.ty), + docs: f.docs.clone(), + same: own_eq(abi, &f.ty), }) .collect(); - let repr = match record.traits.debug { - true => ", repr=False", - false => "", - }; + let docs = format!("{rust}\n\n{}", record.docs); let _ = write!( self.py, - "@_dataclass(slots=True{repr})\nclass {name}:\n{}{fields}{}\n\n", - docstring(&format!("{rust}\n\n{}", record.docs), "\t"), - body.members().iter().map(|m| format!("\n{m}")).collect::() + "{}\n\n", + record_class(&name, "_Record", &docs, &fields, &body.members()) ); // The glue. let mut reads = Vec::new(); @@ -1246,7 +1390,12 @@ impl<'a> Gen<'a> { return; } // Each variant's class, and its fields, which on an instance hide the enum's members. - let mut data: Vec = e.variants.iter().map(|v| kw(&pascal(&v.name))).collect(); + let vnames = variant_classes(e.variants.iter().map(|v| v.name.as_str())); + for (variant, vname) in e.variants.iter().zip(&vnames) { + let key = format!("{} / variant {}", crate::lock::type_key(&e.shown), variant.name); + self.locked.insert(key, format!("{name}.{vname}")); + } + let mut data = vnames.clone(); let fields: BTreeSet = e .variants .iter() @@ -1256,8 +1405,7 @@ impl<'a> Gen<'a> { data.extend(fields); self.methods(&e.methods, (&ty, &owner, &rust), &data, &[], &mut body); // Each variant's class is bound on the enum's once made, after the enum's own. - for variant in &e.variants { - let vname = kw(&pascal(&abi::snake(&variant.name))); + for vname in &vnames { body.native .push(format!("\t{vname}: _typing.TypeAlias = \"_{name}_{vname}\"\n")); } @@ -1267,33 +1415,24 @@ impl<'a> Gen<'a> { docstring(&format!("{rust}\n\n{}", e.docs), "\t"), body.members().iter().map(|m| format!("\n{m}")).collect::() ); - let repr = match e.traits.debug { - true => ", repr=False", - false => "", - }; let mut reads = Vec::new(); let mut writes = Vec::new(); - for (n, variant) in e.variants.iter().enumerate() { - let vname = kw(&pascal(&variant.name)); + for (n, (variant, vname)) in e.variants.iter().zip(&vnames).enumerate() { let class = format!("_{name}_{vname}"); let key = abi::payload(&c, &variant.name); let tv = self.register(&key, class.clone()); - let fields: String = variant - .fields - .iter() - .map(|f| format!("\t{}: {}\n", field_name(&f.name), self.py_field(&f.ty))) + let fields: Vec = (variant.fields.iter()) + .map(|f| Slot { + name: field_name(&f.name), + ty: self.py_field(&f.ty), + docs: f.docs.clone(), + same: own_eq(abi, &f.ty), + }) .collect(); - let fields = match fields.is_empty() { - true => "\tpass\n".to_string(), - false if variant.fields.iter().any(|f| own_eq(abi, &f.ty)) => { - let names: Vec = variant.fields.iter().map(|f| field_name(&f.name)).collect(); - format!("{fields}\n{}", ieee_eq(&class, &names)) - } - false => fields, - }; let _ = write!( self.py, - "@_dataclass(slots=True{repr})\nclass {class}({name}):\n{fields}\n\n{class}.__name__ = \"{vname}\"\n{class}.__qualname__ = \"{name}.{vname}\"\nif not _typing.TYPE_CHECKING:\n\t{name}.{vname} = {class}\n\n\n" + "{}\n\n{class}.__name__ = \"{vname}\"\n{class}.__qualname__ = \"{name}.{vname}\"\nif not _typing.TYPE_CHECKING:\n\t{name}.{vname} = {class}\n\n\n", + record_class(&class, &format!("{name}, _Record"), "", &fields, &[]) ); // A value of a variant the library's target lacks is refused as it crosses. let missing = match abi.cfg(variant.on) { @@ -2099,6 +2238,20 @@ fn member(snake: &str, reserved: &[&str]) -> String { name } +/// The class names of variants `names`, as Python spells them: `FooBar` for Rust's +/// `FooBar` and `Foo_Bar` alike, so a later one an earlier one took takes a trailing `_`. +fn variant_classes<'n>(names: impl Iterator) -> Vec { + let mut classes: Vec = Vec::new(); + for name in names { + let mut class = kw(&pascal(name)); + while classes.contains(&class) { + class.push('_'); + } + classes.push(class); + } + classes +} + /// A field's Python name: a positional one's is `_0`, `_1`, ... fn field_name(name: &str) -> String { match name.starts_with(|c: char| c.is_ascii_digit()) { @@ -2185,29 +2338,92 @@ fn number(ty: &Type) -> &'static str { } } -/// Whether a record or variant holding `ty` needs [`ieee_eq`]: `ty` holds a float, or a -/// block, which may be a buffer passed in whose own `==` compares item by item. +/// Whether a record or variant compares its field of `ty` through `_same`: `ty` holds a +/// float, or a block, which may be a buffer passed in whose own `==` compares item by item. fn own_eq(abi: &Abi, ty: &Type) -> bool { abi.api.holds_float(ty) || ty.holds_block() } -/// The `__eq__` of the dataclass `class` of `fields`, comparing as Rust's `==` does. A -/// dataclass's own compares tuples of its fields, which take a value as equal to itself, so -/// a NaN it holds would equal itself, and a numpy array it holds would raise. -fn ieee_eq(class: &str, fields: &[String]) -> String { - let same: Vec = fields +/// A field of a record's class. +struct Slot { + /// Its Python name. + name: String, + /// Its Python annotation. + ty: String, + docs: String, + /// Whether it compares through `_same`, as [`own_eq`] says. + same: bool, +} + +/// The class `name` of a record, subclassing `bases`, as `@dataclass(slots=True, +/// weakref_slot=True)` would make it but written out, so no `dataclass` runs at import: its +/// `fields` slotted beside a weak reference and in `__match_args__`, an `__init__` taking +/// each, and an `__eq__` comparing each as Rust's `==` does; then its `members`. +/// `_Record`, among `bases`, adds a dataclass's `repr`, `__dataclass_fields__`, and +/// `__replace__`. +fn record_class(name: &str, bases: &str, docs: &str, fields: &[Slot], members: &[String]) -> String { + let quoted: Vec = fields.iter().map(|f| format!("\"{}\"", f.name)).collect(); + let tuple = |items: &[String]| match items { + [one] => format!("({one},)"), + items => format!("({})", items.join(", ")), + }; + let slots: Vec = quoted.iter().cloned().chain(["\"__weakref__\"".to_string()]).collect(); + let mut out = format!( + "class {name}({bases}):\n{}\t__slots__ = {}\n\t__match_args__ = {}\n", + docstring(docs, "\t"), + tuple(&slots), + tuple("ed), + ); + for f in fields { + let _ = write!(out, "\t{}: {}\n{}", f.name, f.ty, docstring(&f.docs, "\t")); + } + if !fields.is_empty() { + let params: Vec = fields.iter().map(|f| format!(", {}: {}", f.name, f.ty)).collect(); + // pyright takes a name with no lower case letter, such as a tuple's `_0`, for a + // constant, which `__init__` would redefine. + let sets: Vec = (fields.iter()) + .map(|f| match f.name.chars().any(char::is_lowercase) { + true => format!("\t\tself.{0} = {0}\n", f.name), + false => format!( + "\t\tself.{0} = {0} # pyright: ignore[reportConstantRedefinition]\n", + f.name + ), + }) + .collect(); + let _ = write!( + out, + "\n\tdef __init__(self{}) -> None:\n{}", + params.concat(), + sets.concat() + ); + } + // As a dataclass's, `__eq__` takes only its own class, not a subclass; the `isinstance` is for + // the type checkers. A dataclass's own `__eq__` compares tuples of its fields before Python 3.13, which take + // a value as equal to itself, so a NaN would equal itself and a numpy array would raise. + let eq: Vec = fields .iter() - .map(|f| format!(" and _same(self.{f}, other.{f})")) + .map(|f| match f.same { + true => format!("_same(self.{0}, other.{0})", f.name), + false => format!("self.{0} == other.{0}", f.name), + }) .collect(); - format!( - "\tdef __eq__(self, other: _object) -> _bool:\n\t\treturn _isinstance(other, {class}){}\n", - same.concat() - ) + let eq = match eq.is_empty() { + true => "True".to_string(), + false => eq.join(" and "), + }; + let _ = write!( + out, + "\n\tdef __eq__(self, other: _object) -> _bool:\n\t\tif not _isinstance(other, {name}) or other.__class__ is not self.__class__:\n\t\t\treturn _NotImplemented\n\t\treturn {eq}\n" + ); + for m in members { + let _ = write!(out, "\n{m}"); + } + out } #[cfg(test)] mod tests { - use super::{member, param_name, param_names}; + use super::{member, param_name, param_names, variant_classes}; use crate::ir::{Param, Type}; #[test] @@ -2231,6 +2447,15 @@ mod tests { assert_eq!(params(&["a", "b"]), ["a", "b"]); } + #[test] + fn variant_classes_keep_apart() { + let names = ["FooBar", "Foo_Bar", "None", "Late"]; + assert_eq!( + variant_classes(names.into_iter()), + ["FooBar", "FooBar_", "None_", "Late"] + ); + } + #[test] fn member_keeps_clear_of_the_runtime_aliases() { assert_eq!(member("_int", &[]), "_int_"); diff --git a/ffi/surface/api/c.h b/ffi/surface/api/c.h index 400991c6d..3a97c236e 100644 --- a/ffi/surface/api/c.h +++ b/ffi/surface/api/c.h @@ -7,7 +7,7 @@ #ifdef __cplusplus extern "C" { #endif -#define API_CONTRACT ((uint64_t)0xe9e73593591b8c17ULL) +#define API_CONTRACT ((uint64_t)0xcadf3d448a865171ULL) uint64_t api_contract(void); uint32_t api_target(void); typedef int32_t api_status; @@ -142,6 +142,7 @@ typedef struct api_Latch api_Latch; typedef struct api_Token api_Token; typedef struct api_Stack api_Stack; typedef struct api_Refusal api_Refusal; +typedef struct api_Fault api_Fault; typedef struct api_c api_c; typedef struct api_Key api_Key; typedef struct api_clash_Seed api_clash_Seed; @@ -1833,6 +1834,9 @@ void api_Refusal_free(api_Refusal *self); void api_Refusal_drop(api_Refusal *self, api_status *status); api_buf api_Refusal_to_string(const api_Refusal *self, api_status *status); api_buf api_Refusal_debug(const api_Refusal *self, api_status *status); +void api_Fault_free(api_Fault *self); +api_buf api_Fault_to_string(const api_Fault *self); +api_buf api_Fault_debug(const api_Fault *self); void api_c_free(api_c *self); bool api_c_eq(const api_c *a, const api_c *b); api_buf api_c_debug(const api_c *self); @@ -2229,6 +2233,7 @@ api_buf api_reasons(api_vec_tuple_Counter_Refusal pairs, api_option_tuple_Counte size_t api_excuse(api_buf note, api_tuple_bytes_Refusal entry, api_status *status); uint32_t api_relay(api_Log log, api_vec_Refusal refusals, api_status *status); bool api_refuse(api_buf reason, uint32_t *out, api_Refusal **err); +bool api_jam(uint32_t n, uint32_t *out, api_Fault **err); api_Platform api_platform(void); uint32_t api_pointer_bits(api_Platform platform); api_Labelled api_same_labelled(api_Labelled labelled); diff --git a/ffi/surface/api/cpp.hpp b/ffi/surface/api/cpp.hpp index ae664c233..0ff640344 100644 --- a/ffi/surface/api/cpp.hpp +++ b/ffi/surface/api/cpp.hpp @@ -524,6 +524,12 @@ namespace api { RUST2_FFI_CALLABLE ::api::buf to_string() const; RUST2_FFI_CALLABLE ::api::buf debug() const; }; + class RUST2_FFI_CONSUMABLE Fault { + RUST2_FFI_UNCONSUMED Fault(Fault &&other RUST2_FFI_MOVED_FROM) noexcept = default; + Fault &operator=(Fault &&other) noexcept = default; + RUST2_FFI_CALLABLE ::api::buf to_string() const; + RUST2_FFI_CALLABLE ::api::buf debug() const; + }; class RUST2_FFI_CONSUMABLE c { RUST2_FFI_UNCONSUMED c(c &&other RUST2_FFI_MOVED_FROM) noexcept = default; c &operator=(c &&other) noexcept = default; @@ -1525,6 +1531,7 @@ namespace api { inline ::std::size_t excuse(::api::input note, ::std::tuple<::api::view, ::api::Refusal> entry); inline ::std::uint32_t relay(::std::unique_ptr<::api::Log> log, ::std::vector<::api::Refusal> refusals); inline ::api::result<::std::uint32_t, ::api::Refusal> refuse(::api::input reason); + inline ::api::result<::std::uint32_t, ::api::Fault> jam(::std::uint32_t n); inline ::api::Platform platform(); inline ::std::uint32_t pointer_bits(const ::api::Platform &platform); inline ::api::Labelled same_labelled(const ::api::Labelled &labelled); @@ -1938,6 +1945,7 @@ namespace api { class Token; class Stack; class Refusal; + class Fault; class c; class Key; class clash_Seed; diff --git a/ffi/surface/api/dart.dart b/ffi/surface/api/dart.dart index 1bde09954..8e2f112ab 100644 --- a/ffi/surface/api/dart.dart +++ b/ffi/surface/api/dart.dart @@ -1332,6 +1332,10 @@ final class Refusal extends _Object implements Exception { @override String toString(); String debug(); } +final class Fault extends _Object implements Exception { + @override String toString(); + String debug(); +} final class C extends _Object { String debug(); @override bool operator ==(Object other); @@ -1680,6 +1684,7 @@ String reasons(List<(Counter, Refusal)> pairs, (Counter, Refusal)? last); U64 excuse(typed.Uint8List note, (typed.Uint8List, Refusal) entry); int relay(Log log, List refusals); int refuse(String reason); +int jam(int n); Platform platform(); int pointerBits(Platform platform); Labelled sameLabelled(Labelled labelled); diff --git a/ffi/surface/api/go.txt b/ffi/surface/api/go.txt index ec9790513..b05f13558 100644 --- a/ffi/surface/api/go.txt +++ b/ffi/surface/api/go.txt @@ -98,6 +98,7 @@ func Hook(f func()) error func Host(url *p_url.Url) (*string, error) func IsFamily(family Family) bool func IsKept(status Status) bool +func Jam(n uint32) (uint32, error) func JniOne() uint32 func JoinWords(words []string) (string, error) func Joined(parts []p_rt.Bytes) p_rt.Bytes @@ -833,6 +834,13 @@ const ( ) func (self Family) Equal(other Family) bool func (self Family) GoString() string +type Fault struct { + Handle_ *p_rt.Handle_ +} +func (self *Fault) Close() error +func (self *Fault) Error() string +func (self *Fault) GoString() string +func (self *Fault) String() string type FiledReceipt struct { Handle_ *p_rt.Handle_ } diff --git a/ffi/surface/api/kotlin.kt b/ffi/surface/api/kotlin.kt index b4120fb43..e55948964 100644 --- a/ffi/surface/api/kotlin.kt +++ b/ffi/surface/api/kotlin.kt @@ -1075,6 +1075,11 @@ class Refusal internal constructor(raw: Long, lent: Boolean = false) : AutoClose final override fun toString(): kotlin.String fun debug(): kotlin.String } +class Fault internal constructor(raw: Long, lent: Boolean = false) : AutoCloseable { + override fun close() + final override fun toString(): kotlin.String + fun debug(): kotlin.String +} class C internal constructor(raw: Long, lent: Boolean = false) : AutoCloseable { override fun close() fun debug(): kotlin.String @@ -1240,6 +1245,9 @@ class BoundsU64Exception(val error: api.BoundsU64) : Exception() { class ErrorException(val error: api.Error) : Exception() { override val message: String } +class FaultException(val error: api.Fault) : Exception() { + override val message: String +} class RefusalException(val error: api.Refusal) : Exception() { override val message: String } @@ -1478,6 +1486,7 @@ fun reasons(pairs: kotlin.collections.List fun excuse(note: api.Bytes, entry: kotlin.Pair): kotlin.ULong fun relay(log: api.Log, refusals: kotlin.collections.List): kotlin.UInt @kotlin.jvm.Throws(RefusalException::class) fun refuse(reason: kotlin.String): kotlin.UInt +@kotlin.jvm.Throws(FaultException::class) fun jam(n: kotlin.UInt): kotlin.UInt fun platform(): api.Platform fun pointerBits(platform: api.Platform): kotlin.UInt fun sameLabelled(labelled: api.Labelled): api.Labelled diff --git a/ffi/surface/api/python.pyi b/ffi/surface/api/python.pyi index 29f6b2887..5bffaac98 100644 --- a/ffi/surface/api/python.pyi +++ b/ffi/surface/api/python.pyi @@ -17,69 +17,80 @@ class Bound(_enum.Enum): UNBOUNDED = 0 INCLUDED = 1 EXCLUDED = 2 -@_dataclass(slots=True) -class BoundU64: +class BoundU64(_Record): kind: Bound value: _int -@_dataclass(slots=True) -class BoundsU64: + def __init__(self, kind: Bound, value: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class BoundsU64(_Record): start: BoundU64 end: BoundU64 + def __init__(self, start: BoundU64, end: BoundU64) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class ArrayU8x4(_bytes): def __new__(cls, value: _bytes | _bytearray | _memoryview) -> _typing.Self: ... -@_dataclass(slots=True) -class Parcel: +class Parcel(_Record): mark: Mark payload: _bytes | _bytearray | _memoryview -@_dataclass(slots=True) -class Weighted: + def __init__(self, mark: Mark, payload: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class Weighted(_Record): score: Score weight: _int + def __init__(self, score: Score, weight: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def total(self) -> _int: ... -@_dataclass(slots=True) -class Stamped: +class Stamped(_Record): at: Stamp count: _int + def __init__(self, at: Stamp, count: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def total(self) -> _int: ... -@_dataclass(slots=True) -class CancellationError: +class CancellationError(_Record): code: _int -@_dataclass(slots=True) -class Packet: + def __init__(self, code: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class Packet(_Record): seq: _int payload: _bytes | _bytearray | _memoryview -@_dataclass(slots=True) -class Hasher: + def __init__(self, seq: _int, payload: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class Hasher(_Record): seed: _int -@_dataclass(slots=True, repr=False) -class Size: + def __init__(self, seed: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class Size(_Record): width: _int height: _int + def __init__(self, width: _int, height: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class Point: +class Point(_Record): x: _int y: _int + def __init__(self, x: _int, y: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod def default() -> Point: ... def offset(self, dx: _int, dy: _int) -> Point: ... @_staticmethod def get_x() -> _int: ... -@_dataclass(slots=True, repr=False) -class Label: +class Label(_Record): name: _str at: Point | None ttl: Duration | None + def __init__(self, name: _str, at: Point | None, ttl: Duration | None) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class Note: +class Note(_Record): text: _str | None + def __init__(self, text: _str | None) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod def default() -> Note: ... -@_dataclass(slots=True, repr=False) -class Reading: +class Reading(_Record): ok: _bool level: _float ratio: _float @@ -91,30 +102,35 @@ class Reading: offset: _int len: _int tag: _int + def __init__(self, ok: _bool, level: _float, ratio: _float, mark: _str, shape: Shape, at: Point, note: _str, count: _int, offset: _int, len: _int, tag: _int) -> None: ... def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def next(self) -> Reading | None: ... -@_dataclass(slots=True, repr=False) -class Packaged: +class Packaged(_Record): api: _int + def __init__(self, api: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def point(self) -> Point: ... def shape(self) -> Shape: ... -@_dataclass(slots=True, repr=False) -class Atlas: +class Atlas(_Record): points: _typing.Sequence[_tuple[_str, Point]] ids: _typing.Sequence[_int] + def __init__(self, points: _typing.Sequence[_tuple[_str, Point]], ids: _typing.Sequence[_int]) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def with_(self, name: _str, at: Point) -> Atlas: ... -@_dataclass(slots=True, repr=False) -class Span: +class Span(_Record): bounds: _tuple[_int, _int] named: _tuple[_str, Shape] | None + def __init__(self, bounds: _tuple[_int, _int], named: _tuple[_str, Shape] | None) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class Window: +class Window(_Record): range: _range end: BoundU64 + def __init__(self, range: _range, end: BoundU64) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def contains(self, n: _int) -> _bool: ... class Ticket(_n.Value): @@ -125,10 +141,11 @@ class Ticket(_n.Value): def number(self) -> _int: ... @_staticmethod def clones() -> _int: ... -@_dataclass(slots=True, repr=False) -class Seat: +class Seat(_Record): mark: Mark row: _int + def __init__(self, mark: Mark, row: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def count(self) -> _int: ... class Stamp(_n.Value): @@ -153,17 +170,20 @@ class LongArray(_n.Value): def new(low: _int, high: _int) -> LongArray: ... def c_(self) -> _int: ... def also(self, f: _typing.Callable[[_int], None]) -> None: ... -@_dataclass(slots=True, repr=False) -class JvmField: +class JvmField(_Record): n: _int + def __init__(self, n: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class JvmStatic: +class JvmStatic(_Record): n: _int + def __init__(self, n: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class OptIn: +class OptIn(_Record): n: _int + def __init__(self, n: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... class Wide(_n.Value): def __eq__(self, other: _object) -> _bool: ... @@ -171,10 +191,11 @@ class Wide(_n.Value): @_staticmethod def new(seed: _int) -> Wide: ... def sum(self) -> _int: ... -@_dataclass(slots=True, repr=False) -class Clocked: +class Clocked(_Record): at: Moment count: _int + def __init__(self, at: Moment, count: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... class Score(_n.Value): def __repr__(self) -> _str: ... @@ -211,89 +232,103 @@ class Extent(_n.Value): def new(start: _int, len: _int) -> Extent: ... def end(self) -> _int: ... def slide(self, by: _int) -> _tuple[Extent, _int]: ... -@_dataclass(slots=True, repr=False) -class PairSizeU8: +class PairSizeU8(_Record): left: Size right: _int + def __init__(self, left: Size, right: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def swap(self) -> PairU8Size: ... -@_dataclass(slots=True, repr=False) -class PairNonZeroU16: +class PairNonZeroU16(_Record): left: _int right: _int + def __init__(self, left: _int, right: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def swap(self) -> PairNonZeroU16: ... def even(self) -> _bool: ... -@_dataclass(slots=True, repr=False) -class PairU32: +class PairU32(_Record): left: _int right: _int + def __init__(self, left: _int, right: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def swap(self) -> PairU32: ... def even(self) -> _bool: ... def sum(self) -> _int: ... def beside_size(self, right: Size) -> PairU8Size: ... -@_dataclass(slots=True, repr=False) -class PairU8Size: +class PairU8Size(_Record): left: _int right: Size + def __init__(self, left: _int, right: Size) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class LeftRightU8: +class LeftRightU8(_Record): value: RightU8 + def __init__(self, value: RightU8) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class LeftU8: +class LeftU8(_Record): value: _int + def __init__(self, value: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class RightLeftU8: +class RightLeftU8(_Record): value: LeftU8 + def __init__(self, value: LeftU8) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class RightU8: +class RightU8(_Record): value: _int + def __init__(self, value: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class InnerU8: +class InnerU8(_Record): value: _int + def __init__(self, value: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class BoxedU16: +class BoxedU16(_Record): value: _int + def __init__(self, value: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class BoxedU8: +class BoxedU8(_Record): value: _int + def __init__(self, value: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class LogCount: +class LogCount(_Record): kept: _int + def __init__(self, kept: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class WrapU32: +class WrapU32(_Record): value: _int + def __init__(self, value: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class PolarTurn: +class PolarTurn(_Record): whole: _int + def __init__(self, whole: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class Peer: +class Peer(_Record): addr: _tuple[_str, _int] | _tuple[_str, _int, _int, _int] names: _typing.Sequence[_str] + def __init__(self, addr: _tuple[_str, _int] | _tuple[_str, _int, _int, _int], names: _typing.Sequence[_str]) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def aliases(self) -> _list[_str]: ... def next(self, name: _str) -> Peer: ... -@_dataclass(slots=True, repr=False) -class Shadowed: +class Shadowed(_Record): other: _array.array[_int] | _memoryview a: _int b: _int + def __init__(self, other: _array.array[_int] | _memoryview, a: _int, b: _int) -> None: ... def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class Numbers: +class Numbers(_Record): u16s: _array.array[_int] | _memoryview u32s: _array.array[_int] | _memoryview u64s: _array.array[_int] | _memoryview @@ -304,6 +339,7 @@ class Numbers: f32s: _array.array[_float] | _memoryview f64s: _array.array[_float] | _memoryview some: _array.array[_int] | _memoryview | None + def __init__(self, u16s: _array.array[_int] | _memoryview, u32s: _array.array[_int] | _memoryview, u64s: _array.array[_int] | _memoryview, i8s: _array.array[_int] | _memoryview, i16s: _array.array[_int] | _memoryview, i32s: _array.array[_int] | _memoryview, i64s: _array.array[_int] | _memoryview, f32s: _array.array[_float] | _memoryview, f64s: _array.array[_float] | _memoryview, some: _array.array[_int] | _memoryview | None) -> None: ... def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod @@ -311,48 +347,54 @@ class Numbers: @_staticmethod def zero(negative: _bool) -> Numbers: ... def reversed(self) -> Numbers: ... -@_dataclass(slots=True, repr=False) -class Measure: +class Measure(_Record): value: _float numbers: Numbers + def __init__(self, value: _float, numbers: Numbers) -> None: ... def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod def new(value: _float, negative: _bool) -> Measure: ... -@_dataclass(slots=True, repr=False) -class LimitsBytes: +class LimitsBytes(_Record): low: _bytes | _bytearray | _memoryview high: _bytes | _bytearray | _memoryview + def __init__(self, low: _bytes | _bytearray | _memoryview, high: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class LimitsDuration: +class LimitsDuration(_Record): low: Duration high: Duration + def __init__(self, low: Duration, high: Duration) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class Page: +class Page(_Record): size: _int + def __init__(self, size: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod def default() -> Page: ... -@_dataclass(slots=True, repr=False) -class Booth: +class Booth(_Record): mark: Mark + def __init__(self, mark: Mark) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class Cancelled: +class Cancelled(_Record): step: _int + def __init__(self, step: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class StartSeekable: +class StartSeekable(_Record): at: _int + def __init__(self, at: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class DoubleArray: +class DoubleArray(_Record): len: _int + def __init__(self, len: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class NonZeros: +class NonZeros(_Record): u8: _int u16: _int u32: _int @@ -363,91 +405,106 @@ class NonZeros: i32: _int i64: _int isize: _int + def __init__(self, u8: _int, u16: _int, u32: _int, u64: _int, usize: _int, i8: _int, i16: _int, i32: _int, i64: _int, isize: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class A: +class A(_Record): b: _int + def __init__(self, b: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True) -class Qualifiers: +class Qualifiers(_Record): api: _float kotlin: _float + def __init__(self, api: _float, kotlin: _float) -> None: ... def __eq__(self, other: _object) -> _bool: ... -@_dataclass(slots=True, repr=False) -class PolarPoint: +class PolarPoint(_Record): turns: _int distance: _int + def __init__(self, turns: _int, distance: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class Polar_Turn: +class Polar_Turn(_Record): part: _int + def __init__(self, part: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class ClashTone: +class ClashTone(_Record): hz: _int + def __init__(self, hz: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class ClashTone_: +class ClashTone_(_Record): db: _int + def __init__(self, db: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class ClashSpan: +class ClashSpan(_Record): width: _int + def __init__(self, width: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __str__(self) -> _str: ... def __repr__(self) -> _str: ... def width_(self) -> _int: ... def to_string(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class ClashAny: +class ClashAny(_Record): type_url: _str + def __init__(self, type_url: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class ClashBreak: +class ClashBreak(_Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... SP = _n.clash_Break_Sp() SP_ = _n.clash_Break_SP() SP = _Const(_n.clash_Break_Sp) SP_ = _Const(_n.clash_Break_SP) -@_dataclass(slots=True, repr=False) -class TlsPolicyLifetime: +class TlsPolicyLifetime(_Record): seconds: _int + def __init__(self, seconds: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True) -class Core: +class Core(_Record): id: _int + def __init__(self, id: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class Choice: Empty: _typing.TypeAlias = '_Choice_Empty' Picked: _typing.TypeAlias = '_Choice_Picked' -@_dataclass(slots=True) -class _Choice_Empty(Choice): - ... -@_dataclass(slots=True) -class _Choice_Picked(Choice): +class _Choice_Empty(Choice, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _Choice_Picked(Choice, _Record): _0: Mark + def __init__(self, _0: Mark) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class Array: U8x4: _typing.TypeAlias = '_Array_U8x4' -@_dataclass(slots=True) -class _Array_U8x4(Array): +class _Array_U8x4(Array, _Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class Platform: Wasm: _typing.TypeAlias = '_Platform_Wasm' Native: _typing.TypeAlias = '_Platform_Native' -@_dataclass(slots=True) -class _Platform_Wasm(Platform): +class _Platform_Wasm(Platform, _Record): bits: _int -@_dataclass(slots=True) -class _Platform_Native(Platform): + def __init__(self, bits: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Platform_Native(Platform, _Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class Placement: Anywhere: _typing.TypeAlias = '_Placement_Anywhere' Pinned: _typing.TypeAlias = '_Placement_Pinned' -@_dataclass(slots=True) -class _Placement_Anywhere(Placement): - ... -@_dataclass(slots=True) -class _Placement_Pinned(Placement): +class _Placement_Anywhere(Placement, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _Placement_Pinned(Placement, _Record): _0: Core + def __init__(self, _0: Core) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class Shape(_enum.Enum): CIRCLE = 1 SQUARE = 4 @@ -463,15 +520,16 @@ class Event: Moved: _typing.TypeAlias = '_Event_Moved' Named: _typing.TypeAlias = '_Event_Named' Done: _typing.TypeAlias = '_Event_Done' -@_dataclass(slots=True, repr=False) -class _Event_Moved(Event): +class _Event_Moved(Event, _Record): _0: Point -@_dataclass(slots=True, repr=False) -class _Event_Named(Event): + def __init__(self, _0: Point) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Event_Named(Event, _Record): name: _str -@_dataclass(slots=True, repr=False) -class _Event_Done(Event): - ... + def __init__(self, name: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Event_Done(Event, _Record): + def __eq__(self, other: _object) -> _bool: ... class Clash: @_staticmethod async def after(first: _typing.Awaitable[None], kotlin: _float) -> Clash: ... @@ -507,81 +565,88 @@ class Clash: Pair: _typing.TypeAlias = '_Clash_Pair' Stamp: _typing.TypeAlias = '_Clash_Stamp' Moment: _typing.TypeAlias = '_Clash_Moment' -@_dataclass(slots=True, repr=False) -class _Clash_Point(Clash): +class _Clash_Point(Clash, _Record): _0: Point -@_dataclass(slots=True, repr=False) -class _Clash_Shape(Clash): + def __init__(self, _0: Point) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Shape(Clash, _Record): _0: Shape -@_dataclass(slots=True, repr=False) -class _Clash_Event(Clash): + def __init__(self, _0: Shape) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Event(Clash, _Record): _0: Event -@_dataclass(slots=True, repr=False) -class _Clash_Double(Clash): + def __init__(self, _0: Event) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Double(Clash, _Record): _0: _float + def __init__(self, _0: _float) -> None: ... def __eq__(self, other: _object) -> _bool: ... -@_dataclass(slots=True, repr=False) -class _Clash_Float(Clash): +class _Clash_Float(Clash, _Record): _0: _float + def __init__(self, _0: _float) -> None: ... def __eq__(self, other: _object) -> _bool: ... -@_dataclass(slots=True, repr=False) -class _Clash_String(Clash): +class _Clash_String(Clash, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _Clash_Int(Clash): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Int(Clash, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _Clash_Boolean(Clash): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Boolean(Clash, _Record): _0: _bool -@_dataclass(slots=True, repr=False) -class _Clash_Native(Clash): + def __init__(self, _0: _bool) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Native(Clash, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _Clash_Bytes(Clash): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Bytes(Clash, _Record): _0: _bytes | _bytearray | _memoryview -@_dataclass(slots=True, repr=False) -class _Clash_Any(Clash): - ... -@_dataclass(slots=True, repr=False) -class _Clash_Unit(Clash): - ... -@_dataclass(slots=True, repr=False) -class _Clash_Waker(Clash): - ... -@_dataclass(slots=True, repr=False) -class _Clash_Mut(Clash): - ... -@_dataclass(slots=True, repr=False) -class _Clash_Pair(Clash): + def __init__(self, _0: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Any(Clash, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Unit(Clash, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Waker(Clash, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Mut(Clash, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Pair(Clash, _Record): _0: _int _1: _int -@_dataclass(slots=True, repr=False) -class _Clash_Stamp(Clash): + def __init__(self, _0: _int, _1: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Stamp(Clash, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _Clash_Moment(Clash): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Clash_Moment(Clash, _Record): _0: Moment + def __init__(self, _0: Moment) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class Stage: def __repr__(self) -> _str: ... Init: _typing.TypeAlias = '_Stage_Init' Done: _typing.TypeAlias = '_Stage_Done' -@_dataclass(slots=True, repr=False) -class _Stage_Init(Stage): +class _Stage_Init(Stage, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _Stage_Done(Stage): - ... + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Stage_Done(Stage, _Record): + def __eq__(self, other: _object) -> _bool: ... class Error: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... Underflow: _typing.TypeAlias = '_Error_Underflow' Overflow: _typing.TypeAlias = '_Error_Overflow' -@_dataclass(slots=True, repr=False) -class _Error_Underflow(Error): +class _Error_Underflow(Error, _Record): by: _int -@_dataclass(slots=True, repr=False) -class _Error_Overflow(Error): - ... + def __init__(self, by: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Error_Overflow(Error, _Record): + def __eq__(self, other: _object) -> _bool: ... class Status(_enum.Enum): MOVED = 0 KEPT = 1 @@ -590,12 +655,12 @@ class Labelled: def __repr__(self) -> _str: ... Tagged: _typing.TypeAlias = '_Labelled_Tagged' Bare: _typing.TypeAlias = '_Labelled_Bare' -@_dataclass(slots=True, repr=False) -class _Labelled_Tagged(Labelled): +class _Labelled_Tagged(Labelled, _Record): tag: _int -@_dataclass(slots=True, repr=False) -class _Labelled_Bare(Labelled): - ... + def __init__(self, tag: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Labelled_Bare(Labelled, _Record): + def __eq__(self, other: _object) -> _bool: ... class Family(_enum.Enum): NATIVE = 0 WASM = 1 @@ -607,43 +672,43 @@ class B: def __repr__(self) -> _str: ... One: _typing.TypeAlias = '_B_One' Two: _typing.TypeAlias = '_B_Two' -@_dataclass(slots=True, repr=False) -class _B_One(B): - ... -@_dataclass(slots=True, repr=False) -class _B_Two(B): +class _B_One(B, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _B_Two(B, _Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class Builtin: Any: _typing.TypeAlias = '_Builtin_Any' Boolean: _typing.TypeAlias = '_Builtin_Boolean' Int: _typing.TypeAlias = '_Builtin_Int' Native: _typing.TypeAlias = '_Builtin_Native' -@_dataclass(slots=True) -class _Builtin_Any(Builtin): +class _Builtin_Any(Builtin, _Record): _0: _array.array[_int] | _memoryview + def __init__(self, _0: _array.array[_int] | _memoryview) -> None: ... def __eq__(self, other: _object) -> _bool: ... -@_dataclass(slots=True) -class _Builtin_Boolean(Builtin): +class _Builtin_Boolean(Builtin, _Record): _0: _float + def __init__(self, _0: _float) -> None: ... def __eq__(self, other: _object) -> _bool: ... -@_dataclass(slots=True) -class _Builtin_Int(Builtin): +class _Builtin_Int(Builtin, _Record): _0: _float + def __init__(self, _0: _float) -> None: ... def __eq__(self, other: _object) -> _bool: ... -@_dataclass(slots=True) -class _Builtin_Native(Builtin): +class _Builtin_Native(Builtin, _Record): _0: _float + def __init__(self, _0: _float) -> None: ... def __eq__(self, other: _object) -> _bool: ... class ClashCandidate: def __repr__(self) -> _str: ... None_: _typing.TypeAlias = '_ClashCandidate_None_' Match: _typing.TypeAlias = '_ClashCandidate_Match' -@_dataclass(slots=True, repr=False) -class _ClashCandidate_None_(ClashCandidate): - ... -@_dataclass(slots=True, repr=False) -class _ClashCandidate_Match(ClashCandidate): +class _ClashCandidate_None_(ClashCandidate, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _ClashCandidate_Match(ClashCandidate, _Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class Level(_enum.Enum): TRACE = 0 DEBUG = 1 @@ -1076,6 +1141,9 @@ class Stack(_n.Object): class Refusal(_n.Object): def __str__(self) -> _str: ... def __repr__(self) -> _str: ... +class Fault(_n.Object): + def __str__(self) -> _str: ... + def __repr__(self) -> _str: ... class C(_n.Object): def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @@ -1181,8 +1249,28 @@ class BoundsU64Exception(_Exception): def __init__(self, error: BoundsU64) -> None: ... def __str__(self) -> _str: ... class ErrorException(_Exception): + def __new__(cls, error: Error) -> _typing.Self: ... def __init__(self, error: Error) -> None: ... def __str__(self) -> _str: ... + Underflow: _typing.TypeAlias = '_ErrorException_Underflow' + Overflow: _typing.TypeAlias = '_ErrorException_Overflow' +class _ErrorException_Underflow(ErrorException): + ... +class _ErrorException_Overflow(ErrorException): + ... +class FaultException(_Exception): + def __new__(cls, error: Fault) -> _typing.Self: ... + def __init__(self, error: Fault) -> None: ... + def __str__(self) -> _str: ... + Busy: _typing.TypeAlias = '_FaultException_Busy' + Lost: _typing.TypeAlias = '_FaultException_Lost' + Late: _typing.TypeAlias = '_FaultException_Late' +class _FaultException_Busy(FaultException): + ... +class _FaultException_Lost(FaultException): + ... +class _FaultException_Late(FaultException): + ... class ListClashToneException(_Exception): def __init__(self, error: _list[ClashTone]) -> None: ... def __str__(self) -> _str: ... @@ -1415,6 +1503,7 @@ def reasons(pairs: _typing.Iterable[_tuple[Counter, Refusal]], last: _tuple[Coun def excuse(note: _bytes | _bytearray | _memoryview, entry: _tuple[_bytes | _bytearray | _memoryview, Refusal]) -> _int: ... def relay(log: Log, refusals: _typing.Iterable[Refusal]) -> _int: ... def refuse(reason: _str) -> _int: ... +def jam(n: _int) -> _int: ... def platform() -> Platform: ... def pointer_bits(platform: Platform) -> _int: ... def same_labelled(labelled: Labelled) -> Labelled: ... @@ -1671,6 +1760,7 @@ reasons = _n.reasons excuse = _n.excuse relay = _n.relay refuse = _n.refuse +jam = _n.jam platform = _n.platform pointer_bits = _n.pointer_bits same_labelled = _n.same_labelled diff --git a/ffi/surface/api/swift.swift b/ffi/surface/api/swift.swift index 61b55843f..6bad3ed5c 100644 --- a/ffi/surface/api/swift.swift +++ b/ffi/surface/api/swift.swift @@ -1159,6 +1159,10 @@ public final class Refusal: @unchecked Sendable { @inlinable public var description: Swift.String { get } @inlinable public var debugDescription: Swift.String { get } } +public final class Fault: @unchecked Sendable, CustomStringConvertible, CustomDebugStringConvertible { + @inlinable public var description: Swift.String { get } + @inlinable public var debugDescription: Swift.String { get } +} public struct C: ~Copyable, @unchecked Sendable { @inlinable public var debugDescription: Swift.String { get } @inlinable public static func == (a: borrowing C, b: borrowing C) -> Swift.Bool @@ -1280,6 +1284,7 @@ public struct VecClashToneError: Swift.Error, CustomStringConvertible { @inlinable public var description: Swift.String { get } } extension Error: Swift.Error {} +extension Fault: Swift.Error {} extension Refusal: Swift.Error {} public let LIMIT: Swift.UInt64 public let FAR: Swift.Int64 @@ -1510,6 +1515,7 @@ public let FAR: Swift.Int64 @inlinable public func excuse(_ note: Bytes, _ entry: (Bytes, Refusal)) throws -> Swift.UInt @inlinable public func relay(_ log: any Log, _ refusals: [Refusal]) throws -> Swift.UInt32 @inlinable public func refuse(_ reason: Swift.String) throws -> Swift.UInt32 +@inlinable public func jam(_ n: Swift.UInt32) throws -> Swift.UInt32 @inlinable public func platform() -> Platform @inlinable public func pointerBits(_ platform: Platform) -> Swift.UInt32 @inlinable public func sameLabelled(_ labelled: Labelled) -> Labelled diff --git a/ffi/surface/api/web.d.ts b/ffi/surface/api/web.d.ts index e2cf89271..0b1317501 100644 --- a/ffi/surface/api/web.d.ts +++ b/ffi/surface/api/web.d.ts @@ -455,6 +455,12 @@ export { new$ as new }; export type Family = "Native" | "Wasm"; export declare function debug(self: Family): string; +// Fault.ts +import * as rt from "./rt.ts"; +export type Fault = rt.Handle<"Fault">; +export declare function toString(self: Fault): string; +export declare function debug(self: Fault): string; + // FiledReceipt.ts import * as rt from "./rt.ts"; export type FiledReceipt = rt.Handle<"FiledReceipt">; @@ -1608,6 +1614,7 @@ export declare const k_Cursor: rt.Kind; export declare const k_Der: rt.Kind; export declare const k_Digest: rt.Kind; export declare const k_Draft: rt.Kind; +export declare const k_Fault: rt.Kind; export declare const k_Filed_Receipt: rt.Kind; export declare const k_Gap: rt.Kind; export declare const k_Gauge: rt.Kind; @@ -2083,6 +2090,7 @@ import type { Draft } from "./Draft.ts"; import type { Error_ } from "./Error_.ts"; import type { Event } from "./Event.ts"; import type { Family } from "./Family.ts"; +import type { Fault } from "./Fault.ts"; import type { Gauge } from "./Gauge.ts"; import type { Instant } from "./Instant.ts"; import type { Json } from "./Json.ts"; @@ -2434,6 +2442,7 @@ export declare function reasons(pairs: ([Counter, Refusal])[], last: [Counter, R export declare function excuse(note: Uint8Array | rt.Bytes, entry: [Uint8Array, Refusal]): number; export declare function relay(log: Log, refusals: Refusal[]): number; export declare function refuse(reason: string): rt.Result; +export declare function jam(n: number): rt.Result; export declare function platform(): Platform; export declare function pointerBits(platform: Platform): number; export declare function sameLabelled(labelled: Labelled): Labelled; diff --git a/ffi/surface/moq/python.pyi b/ffi/surface/moq/python.pyi index a6b3c1163..4bd865dd7 100644 --- a/ffi/surface/moq/python.pyi +++ b/ffi/surface/moq/python.pyi @@ -17,14 +17,16 @@ class Bound(_enum.Enum): UNBOUNDED = 0 INCLUDED = 1 EXCLUDED = 2 -@_dataclass(slots=True) -class BoundU64: +class BoundU64(_Record): kind: Bound value: _int -@_dataclass(slots=True) -class BoundsU64: + def __init__(self, kind: Bound, value: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class BoundsU64(_Record): start: BoundU64 end: BoundU64 + def __init__(self, start: BoundU64, end: BoundU64) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class ArrayU8x16(_bytes): def __new__(cls, value: _bytes | _bytearray | _memoryview) -> _typing.Self: ... class ArrayU8x2(_bytes): @@ -93,10 +95,11 @@ class ClockWall(_n.Value): def checked_sub(self, duration: Duration) -> ClockWall | None: ... UNIX_EPOCH = _Const(_n.clock_Wall_UNIX_EPOCH) MOQ_EPOCH = _Const(_n.clock_Wall_MOQ_EPOCH) -@_dataclass(slots=True, repr=False) -class SetupToken: +class SetupToken(_Record): kind: _int value: _bytes | _bytearray | _memoryview + def __init__(self, kind: _int, value: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... class SessionLimits(_n.Value): def __eq__(self, other: _object) -> _bool: ... @@ -396,25 +399,29 @@ class BandwidthRate(_n.Value): def scaled(self, factor: _float) -> BandwidthRate: ... def abs_diff(self, other: BandwidthRate) -> BandwidthRate: ... ZERO = _Const(_n.bandwidth_Rate_ZERO) -@_dataclass(slots=True, repr=False) -class DatagramDatagram: +class DatagramDatagram(_Record): sequence: _int timestamp: Timestamp payload: _bytes | _bytearray | _memoryview + def __init__(self, sequence: _int, timestamp: Timestamp, payload: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class FrameInfo: +class FrameInfo(_Record): size: _int timestamp: Timestamp + def __init__(self, size: _int, timestamp: Timestamp) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class GroupInfo: +class GroupInfo(_Record): start: _int + def __init__(self, start: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class TrackDelay: +class TrackDelay(_Record): min: Duration | None max: Duration | None + def __init__(self, min: Duration | None, max: Duration | None) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod def default() -> TrackDelay: ... @@ -436,10 +443,11 @@ class TrackPosition(_n.Value): def new(group: _int, frame: _int) -> TrackPosition: ... @_staticmethod def group(group: _int) -> TrackPosition: ... -@_dataclass(slots=True, repr=False) -class TrackRange: +class TrackRange(_Record): start: TrackAnchor end: TrackAnchor | None + def __init__(self, start: TrackAnchor, end: TrackAnchor | None) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod def live() -> TrackRange: ... @@ -462,9 +470,10 @@ class OriginPriority(_n.Value): @_staticmethod def new(priority: _int) -> OriginPriority: ... def value(self) -> _int: ... -@_dataclass(slots=True, repr=False) -class HangCatalogAac: +class HangCatalogAac(_Record): profile: _int + def __init__(self, profile: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __str__(self) -> _str: ... def __repr__(self) -> _str: ... class HangCatalogPriorities(_n.Value): @@ -482,8 +491,7 @@ class HangCatalogPriorities(_n.Value): @_property def video_get(self) -> _int: ... def video_set(self, value: _int) -> HangCatalogPriorities: ... -@_dataclass(slots=True, repr=False) -class HangCatalogAv1: +class HangCatalogAv1(_Record): profile: _int level: _int tier: _str @@ -496,43 +504,46 @@ class HangCatalogAv1: transfer_characteristics: _int matrix_coefficients: _int full_range: _bool + def __init__(self, profile: _int, level: _int, tier: _str, bitdepth: _int, mono_chrome: _bool, chroma_subsampling_x: _bool, chroma_subsampling_y: _bool, chroma_sample_position: _int, color_primaries: _int, transfer_characteristics: _int, matrix_coefficients: _int, full_range: _bool) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @_staticmethod def default() -> HangCatalogAv1: ... PREFIX = _n.hang_catalog_AV1_PREFIX() PREFIX = _Const(_n.hang_catalog_AV1_PREFIX) -@_dataclass(slots=True, repr=False) -class HangCatalogMastering: +class HangCatalogMastering(_Record): red: HangCatalogChromaticity green: HangCatalogChromaticity blue: HangCatalogChromaticity white: HangCatalogChromaticity max_luminance: _float min_luminance: _float + def __init__(self, red: HangCatalogChromaticity, green: HangCatalogChromaticity, blue: HangCatalogChromaticity, white: HangCatalogChromaticity, max_luminance: _float, min_luminance: _float) -> None: ... def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class HangCatalogChromaticity: +class HangCatalogChromaticity(_Record): x: _float y: _float + def __init__(self, x: _float, y: _float) -> None: ... def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class HangCatalogContentLight: +class HangCatalogContentLight(_Record): max_cll: _int max_fall: _int + def __init__(self, max_cll: _int, max_fall: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class HangCatalogH264: +class HangCatalogH264(_Record): inline: _bool profile: _int constraints: _int level: _int + def __init__(self, inline: _bool, profile: _int, constraints: _int, level: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __str__(self) -> _str: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class HangCatalogH265: +class HangCatalogH265(_Record): in_band: _bool profile_space: _int profile_idc: _int @@ -540,10 +551,11 @@ class HangCatalogH265: tier_flag: _bool level_idc: _int constraint_flags: ArrayU8x6 + def __init__(self, in_band: _bool, profile_space: _int, profile_idc: _int, profile_compatibility_flags: ArrayU8x4, tier_flag: _bool, level_idc: _int, constraint_flags: ArrayU8x6) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __str__(self) -> _str: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class HangCatalogVp9: +class HangCatalogVp9(_Record): profile: _int level: _int bit_depth: _int @@ -552,41 +564,48 @@ class HangCatalogVp9: transfer_characteristics: _int matrix_coefficients: _int full_range: _bool + def __init__(self, profile: _int, level: _int, bit_depth: _int, chroma_subsampling: _int, color_primaries: _int, transfer_characteristics: _int, matrix_coefficients: _int, full_range: _bool) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @_staticmethod def default() -> HangCatalogVp9: ... -@_dataclass(slots=True, repr=False) -class HangCatalogDisplay: +class HangCatalogDisplay(_Record): width: _int height: _int + def __init__(self, width: _int, height: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class HangContainerFrame: +class HangContainerFrame(_Record): timestamp: Timestamp payload: _bytes | _bytearray | _memoryview + def __init__(self, timestamp: Timestamp, payload: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... def encode(self, buf: Mut[_memoryview]) -> None: ... @_staticmethod def decode(buf: _bytes | _bytearray | _memoryview) -> HangContainerFrame: ... def write_to(self, group: GroupProducer) -> None: ... -@_dataclass(slots=True, repr=False) -class MuxContainerFrame: +class MuxContainerFrame(_Record): timestamp: Timestamp duration: Timestamp | None payload: _bytes | _bytearray | _memoryview keyframe: _bool + def __init__(self, timestamp: Timestamp, duration: Timestamp | None, payload: _bytes | _bytearray | _memoryview, keyframe: _bool) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class MuxContainerTimestampRewind: +class MuxContainerTimestampRewind(_Record): timestamp: Timestamp floor: Timestamp + def __init__(self, timestamp: Timestamp, floor: Timestamp) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __str__(self) -> _str: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class MuxContainerPlayout: +class MuxContainerPlayout(_Record): delay: TrackDelay warmup: Duration + def __init__(self, delay: TrackDelay, warmup: Duration) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod def default() -> MuxContainerPlayout: ... @@ -597,8 +616,7 @@ class MuxContainerPlayout: def consumer_fmp4_wire(self, track: TrackSubscriber, format: MuxContainerFmp4Wire) -> MuxContainerConsumerFmp4Wire: ... def consumer_legacy_wire(self, track: TrackSubscriber, format: MuxContainerLegacyWire) -> MuxContainerConsumerLegacyWire: ... def consumer_loc_wire(self, track: TrackSubscriber, format: MuxContainerLocWire) -> MuxContainerConsumerLocWire: ... -@_dataclass(slots=True, repr=False) -class MuxCodecFlacConfig: +class MuxCodecFlacConfig(_Record): min_block_size: _int max_block_size: _int min_frame_size: _int @@ -608,6 +626,8 @@ class MuxCodecFlacConfig: bits_per_sample: _int total_samples: _int md5: ArrayU8x16 + def __init__(self, min_block_size: _int, max_block_size: _int, min_frame_size: _int, max_frame_size: _int, sample_rate: _int, channel_count: _int, bits_per_sample: _int, total_samples: _int, md5: ArrayU8x16) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod def parse_stream_info(buf: Mut[_memoryview]) -> MuxCodecFlacConfig: ... @@ -615,27 +635,30 @@ class MuxCodecFlacConfig: def parse(buf: Mut[_memoryview]) -> MuxCodecFlacConfig: ... def encode_stream_info(self) -> _memoryview: ... def description(self) -> _memoryview: ... -@_dataclass(slots=True, repr=False) -class MuxCodecH264Sps: +class MuxCodecH264Sps(_Record): profile: _int constraints: _int level: _int coded_width: _int coded_height: _int + def __init__(self, profile: _int, constraints: _int, level: _int, coded_width: _int, coded_height: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... @_staticmethod def parse(nal: _bytes | _bytearray | _memoryview) -> MuxCodecH264Sps: ... -@_dataclass(slots=True, repr=False) -class MuxCodecH265VideoSignal: +class MuxCodecH265VideoSignal(_Record): primaries: _int transfer: _int matrix: _int full_range: _bool + def __init__(self, primaries: _int, transfer: _int, matrix: _int, full_range: _bool) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True) -class MuxCodecMp3Config: +class MuxCodecMp3Config(_Record): sample_rate: _int channel_count: _int + def __init__(self, sample_rate: _int, channel_count: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... @_staticmethod def parse(data: _bytes | _bytearray | _memoryview) -> MuxCodecMp3Config: ... class MuxCodecOpusMapping(_n.Value): @@ -645,31 +668,37 @@ class MuxCodecOpusMapping(_n.Value): def streams(self) -> _int: ... def coupled(self) -> _int: ... def table(self) -> _memoryview: ... -@_dataclass(slots=True, repr=False) -class MuxContainerFmp4Fragment: +class MuxContainerFmp4Fragment(_Record): data: _bytes | _bytearray | _memoryview independent: _bool duration: Duration + def __init__(self, data: _bytes | _bytearray | _memoryview, independent: _bool, duration: Duration) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True) -class MuxContainerLegacyWire: +class MuxContainerLegacyWire(_Record): _0: MuxContainerKind -@_dataclass(slots=True) -class MuxContainerLocWire: + def __init__(self, _0: MuxContainerKind) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class MuxContainerLocWire(_Record): _0: MuxContainerKind -@_dataclass(slots=True, repr=False) -class MuxContainerTsDescriptor: + def __init__(self, _0: MuxContainerKind) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class MuxContainerTsDescriptor(_Record): tag: _int data: _bytes | _bytearray | _memoryview + def __init__(self, tag: _int, data: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class RustlsClientTicketRequest: +class RustlsClientTicketRequest(_Record): new_session_count: _int resumption_count: _int + def __init__(self, new_session_count: _int, resumption_count: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... -@_dataclass(slots=True, repr=False) -class RustlsCryptoHpkeHpkePublicKey: +class RustlsCryptoHpkeHpkePublicKey(_Record): _0: _bytes | _bytearray | _memoryview + def __init__(self, _0: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... def __repr__(self) -> _str: ... class EncodeError(_enum.Enum): BOUNDS_EXCEEDED = 0 @@ -688,18 +717,16 @@ class InvalidPattern: InvalidSegment: _typing.TypeAlias = '_InvalidPattern_InvalidSegment' MultipleGlobstars: _typing.TypeAlias = '_InvalidPattern_MultipleGlobstars' TooManySegments: _typing.TypeAlias = '_InvalidPattern_TooManySegments' -@_dataclass(slots=True, repr=False) -class _InvalidPattern_EmptySegment(InvalidPattern): - ... -@_dataclass(slots=True, repr=False) -class _InvalidPattern_InvalidSegment(InvalidPattern): +class _InvalidPattern_EmptySegment(InvalidPattern, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _InvalidPattern_InvalidSegment(InvalidPattern, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _InvalidPattern_MultipleGlobstars(InvalidPattern): - ... -@_dataclass(slots=True, repr=False) -class _InvalidPattern_TooManySegments(InvalidPattern): - ... + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _InvalidPattern_MultipleGlobstars(InvalidPattern, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _InvalidPattern_TooManySegments(InvalidPattern, _Record): + def __eq__(self, other: _object) -> _bool: ... class SessionError: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @@ -719,45 +746,36 @@ class SessionError: App: _typing.TypeAlias = '_SessionError_App' Unknown: _typing.TypeAlias = '_SessionError_Unknown' Unsupported: _typing.TypeAlias = '_SessionError_Unsupported' -@_dataclass(slots=True, repr=False) -class _SessionError_Cancel(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_Internal(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_Unauthorized(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_Expired(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_ProtocolViolation(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_TooManyRequests(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_GoawayTimeout(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_Timeout(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_Version(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_MalformedAuthToken(SessionError): - ... -@_dataclass(slots=True, repr=False) -class _SessionError_App(SessionError): +class _SessionError_Cancel(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_Internal(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_Unauthorized(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_Expired(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_ProtocolViolation(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_TooManyRequests(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_GoawayTimeout(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_Timeout(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_Version(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_MalformedAuthToken(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_App(SessionError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _SessionError_Unknown(SessionError): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_Unknown(SessionError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _SessionError_Unsupported(SessionError): - ... + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _SessionError_Unsupported(SessionError, _Record): + def __eq__(self, other: _object) -> _bool: ... class StreamError: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @@ -783,63 +801,50 @@ class StreamError: Unauthorized: _typing.TypeAlias = '_StreamError_Unauthorized' App: _typing.TypeAlias = '_StreamError_App' Unknown: _typing.TypeAlias = '_StreamError_Unknown' -@_dataclass(slots=True, repr=False) -class _StreamError_Session(StreamError): +class _StreamError_Session(StreamError, _Record): _0: SessionError -@_dataclass(slots=True, repr=False) -class _StreamError_Internal(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_Cancel(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_DeliveryTimeout(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_ControlTimeout(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_GoingAway(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_TooFarBehind(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_MalformedTrack(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_NotFound(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_Unroutable(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_Old(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_Evicted(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_WrongSize(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_FrameTooLarge(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_GroupTooLarge(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_TimestampMismatch(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_Unauthorized(StreamError): - ... -@_dataclass(slots=True, repr=False) -class _StreamError_App(StreamError): + def __init__(self, _0: SessionError) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_Internal(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_Cancel(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_DeliveryTimeout(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_ControlTimeout(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_GoingAway(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_TooFarBehind(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_MalformedTrack(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_NotFound(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_Unroutable(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_Old(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_Evicted(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_WrongSize(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_FrameTooLarge(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_GroupTooLarge(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_TimestampMismatch(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_Unauthorized(StreamError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_App(StreamError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _StreamError_Unknown(StreamError): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _StreamError_Unknown(StreamError, _Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class Retry(_enum.Enum): SAME = 0 REROUTE = 1 @@ -856,19 +861,19 @@ class Segment: Wildcard: _typing.TypeAlias = '_Segment_Wildcard' Partial: _typing.TypeAlias = '_Segment_Partial' Globstar: _typing.TypeAlias = '_Segment_Globstar' -@_dataclass(slots=True, repr=False) -class _Segment_Literal(Segment): +class _Segment_Literal(Segment, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _Segment_Wildcard(Segment): - ... -@_dataclass(slots=True, repr=False) -class _Segment_Partial(Segment): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Segment_Wildcard(Segment, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _Segment_Partial(Segment, _Record): prefix: _str suffix: _str -@_dataclass(slots=True, repr=False) -class _Segment_Globstar(Segment): - ... + def __init__(self, prefix: _str, suffix: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _Segment_Globstar(Segment, _Record): + def __eq__(self, other: _object) -> _bool: ... class ClockMissedTickBehavior(_enum.Enum): BURST = 0 DELAY = 1 @@ -1005,12 +1010,12 @@ class TransportLimitsError: def __repr__(self) -> _str: ... Unsupported: _typing.TypeAlias = '_TransportLimitsError_Unsupported' Refused: _typing.TypeAlias = '_TransportLimitsError_Refused' -@_dataclass(slots=True, repr=False) -class _TransportLimitsError_Unsupported(TransportLimitsError): - ... -@_dataclass(slots=True, repr=False) -class _TransportLimitsError_Refused(TransportLimitsError): +class _TransportLimitsError_Unsupported(TransportLimitsError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _TransportLimitsError_Refused(TransportLimitsError, _Record): _0: _str + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class TransportCloseKind(_enum.Enum): TRANSPORT = 0 IDLE_TIMEOUT = 1 @@ -1034,15 +1039,16 @@ class TrackAnchor: Relative: _typing.TypeAlias = '_TrackAnchor_Relative' Oldest: _typing.TypeAlias = '_TrackAnchor_Oldest' Time: _typing.TypeAlias = '_TrackAnchor_Time' -@_dataclass(slots=True, repr=False) -class _TrackAnchor_Relative(TrackAnchor): +class _TrackAnchor_Relative(TrackAnchor, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _TrackAnchor_Oldest(TrackAnchor): - ... -@_dataclass(slots=True, repr=False) -class _TrackAnchor_Time(TrackAnchor): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _TrackAnchor_Oldest(TrackAnchor, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _TrackAnchor_Time(TrackAnchor, _Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class TrackOrder(_enum.Enum): ASCENDING = 0 DESCENDING = 1 @@ -1076,33 +1082,28 @@ class HangCatalogAudioCodec: Ac3: _typing.TypeAlias = '_HangCatalogAudioCodec_Ac3' Ec3: _typing.TypeAlias = '_HangCatalogAudioCodec_Ec3' Unknown: _typing.TypeAlias = '_HangCatalogAudioCodec_Unknown' -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioCodec_Aac(HangCatalogAudioCodec): +class _HangCatalogAudioCodec_Aac(HangCatalogAudioCodec, _Record): _0: HangCatalogAac -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioCodec_Opus(HangCatalogAudioCodec): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioCodec_Pcm(HangCatalogAudioCodec): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioCodec_Flac(HangCatalogAudioCodec): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioCodec_Mp3(HangCatalogAudioCodec): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioCodec_Mp2(HangCatalogAudioCodec): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioCodec_Ac3(HangCatalogAudioCodec): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioCodec_Ec3(HangCatalogAudioCodec): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioCodec_Unknown(HangCatalogAudioCodec): + def __init__(self, _0: HangCatalogAac) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogAudioCodec_Opus(HangCatalogAudioCodec, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogAudioCodec_Pcm(HangCatalogAudioCodec, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogAudioCodec_Flac(HangCatalogAudioCodec, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogAudioCodec_Mp3(HangCatalogAudioCodec, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogAudioCodec_Mp2(HangCatalogAudioCodec, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogAudioCodec_Ac3(HangCatalogAudioCodec, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogAudioCodec_Ec3(HangCatalogAudioCodec, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogAudioCodec_Unknown(HangCatalogAudioCodec, _Record): _0: _str + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class HangCatalogAudioCodecKind(_enum.Enum): AAC = 0 OPUS = 1 @@ -1118,27 +1119,26 @@ class HangCatalogAudioLayout: def __repr__(self) -> _str: ... Ambisonic: _typing.TypeAlias = '_HangCatalogAudioLayout_Ambisonic' Unknown: _typing.TypeAlias = '_HangCatalogAudioLayout_Unknown' -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioLayout_Ambisonic(HangCatalogAudioLayout): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogAudioLayout_Unknown(HangCatalogAudioLayout): +class _HangCatalogAudioLayout_Ambisonic(HangCatalogAudioLayout, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogAudioLayout_Unknown(HangCatalogAudioLayout, _Record): _0: _str + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class HangCatalogMode: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... Snapshot: _typing.TypeAlias = '_HangCatalogMode_Snapshot' Stream: _typing.TypeAlias = '_HangCatalogMode_Stream' Unknown: _typing.TypeAlias = '_HangCatalogMode_Unknown' -@_dataclass(slots=True, repr=False) -class _HangCatalogMode_Snapshot(HangCatalogMode): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogMode_Stream(HangCatalogMode): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogMode_Unknown(HangCatalogMode): +class _HangCatalogMode_Snapshot(HangCatalogMode, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogMode_Stream(HangCatalogMode, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogMode_Unknown(HangCatalogMode, _Record): _0: _str + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class HangCatalogTextFormat: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @@ -1148,18 +1148,16 @@ class HangCatalogTextFormat: Ttml: _typing.TypeAlias = '_HangCatalogTextFormat_Ttml' Utf8: _typing.TypeAlias = '_HangCatalogTextFormat_Utf8' Unknown: _typing.TypeAlias = '_HangCatalogTextFormat_Unknown' -@_dataclass(slots=True, repr=False) -class _HangCatalogTextFormat_Vtt(HangCatalogTextFormat): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogTextFormat_Ttml(HangCatalogTextFormat): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogTextFormat_Utf8(HangCatalogTextFormat): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogTextFormat_Unknown(HangCatalogTextFormat): +class _HangCatalogTextFormat_Vtt(HangCatalogTextFormat, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogTextFormat_Ttml(HangCatalogTextFormat, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogTextFormat_Utf8(HangCatalogTextFormat, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogTextFormat_Unknown(HangCatalogTextFormat, _Record): _0: _str + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class HangCatalogTextRole: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @@ -1168,15 +1166,14 @@ class HangCatalogTextRole: Subtitle: _typing.TypeAlias = '_HangCatalogTextRole_Subtitle' Caption: _typing.TypeAlias = '_HangCatalogTextRole_Caption' Unknown: _typing.TypeAlias = '_HangCatalogTextRole_Unknown' -@_dataclass(slots=True, repr=False) -class _HangCatalogTextRole_Subtitle(HangCatalogTextRole): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogTextRole_Caption(HangCatalogTextRole): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogTextRole_Unknown(HangCatalogTextRole): +class _HangCatalogTextRole_Subtitle(HangCatalogTextRole, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogTextRole_Caption(HangCatalogTextRole, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogTextRole_Unknown(HangCatalogTextRole, _Record): _0: _str + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class HangCatalogVideoCodec: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @@ -1187,24 +1184,28 @@ class HangCatalogVideoCodec: Av1: _typing.TypeAlias = '_HangCatalogVideoCodec_Av1' Vp8: _typing.TypeAlias = '_HangCatalogVideoCodec_Vp8' Unknown: _typing.TypeAlias = '_HangCatalogVideoCodec_Unknown' -@_dataclass(slots=True, repr=False) -class _HangCatalogVideoCodec_H264(HangCatalogVideoCodec): +class _HangCatalogVideoCodec_H264(HangCatalogVideoCodec, _Record): _0: HangCatalogH264 -@_dataclass(slots=True, repr=False) -class _HangCatalogVideoCodec_H265(HangCatalogVideoCodec): + def __init__(self, _0: HangCatalogH264) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogVideoCodec_H265(HangCatalogVideoCodec, _Record): _0: HangCatalogH265 -@_dataclass(slots=True, repr=False) -class _HangCatalogVideoCodec_Vp9(HangCatalogVideoCodec): + def __init__(self, _0: HangCatalogH265) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogVideoCodec_Vp9(HangCatalogVideoCodec, _Record): _0: HangCatalogVp9 -@_dataclass(slots=True, repr=False) -class _HangCatalogVideoCodec_Av1(HangCatalogVideoCodec): + def __init__(self, _0: HangCatalogVp9) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogVideoCodec_Av1(HangCatalogVideoCodec, _Record): _0: HangCatalogAv1 -@_dataclass(slots=True, repr=False) -class _HangCatalogVideoCodec_Vp8(HangCatalogVideoCodec): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogVideoCodec_Unknown(HangCatalogVideoCodec): + def __init__(self, _0: HangCatalogAv1) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogVideoCodec_Vp8(HangCatalogVideoCodec, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogVideoCodec_Unknown(HangCatalogVideoCodec, _Record): _0: _str + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class HangCatalogVideoCodecKind(_enum.Enum): H264 = 0 H265 = 1 @@ -1224,18 +1225,16 @@ class HangCatalogStereo: LeftRight: _typing.TypeAlias = '_HangCatalogStereo_LeftRight' TopBottom: _typing.TypeAlias = '_HangCatalogStereo_TopBottom' Unknown: _typing.TypeAlias = '_HangCatalogStereo_Unknown' -@_dataclass(slots=True, repr=False) -class _HangCatalogStereo_Mono(HangCatalogStereo): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogStereo_LeftRight(HangCatalogStereo): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogStereo_TopBottom(HangCatalogStereo): - ... -@_dataclass(slots=True, repr=False) -class _HangCatalogStereo_Unknown(HangCatalogStereo): +class _HangCatalogStereo_Mono(HangCatalogStereo, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogStereo_LeftRight(HangCatalogStereo, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogStereo_TopBottom(HangCatalogStereo, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _HangCatalogStereo_Unknown(HangCatalogStereo, _Record): _0: _str + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class MuxCatalogCatalogFormat(_enum.Enum): HANG = 0 MSF = 1 @@ -1257,18 +1256,21 @@ class MuxContainerRead: Frame: _typing.TypeAlias = '_MuxContainerRead_Frame' Gap: _typing.TypeAlias = '_MuxContainerRead_Gap' End: _typing.TypeAlias = '_MuxContainerRead_End' -@_dataclass(slots=True, repr=False) -class _MuxContainerRead_Frame(MuxContainerRead): +class _MuxContainerRead_Frame(MuxContainerRead, _Record): group: _int frame: MuxContainerFrame -@_dataclass(slots=True, repr=False) -class _MuxContainerRead_Gap(MuxContainerRead): + def __init__(self, group: _int, frame: MuxContainerFrame) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerRead_Gap(MuxContainerRead, _Record): timestamp: Timestamp duration: Timestamp -@_dataclass(slots=True, repr=False) -class _MuxContainerRead_End(MuxContainerRead): + def __init__(self, timestamp: Timestamp, duration: Timestamp) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerRead_End(MuxContainerRead, _Record): group: _int end: Timestamp + def __init__(self, group: _int, end: Timestamp) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class MuxContainerReorderError: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @@ -1278,27 +1280,27 @@ class MuxContainerReorderError: Presentation: _typing.TypeAlias = '_MuxContainerReorderError_Presentation' Tie: _typing.TypeAlias = '_MuxContainerReorderError_Tie' Undrained: _typing.TypeAlias = '_MuxContainerReorderError_Undrained' -@_dataclass(slots=True, repr=False) -class _MuxContainerReorderError_Depth(MuxContainerReorderError): +class _MuxContainerReorderError_Depth(MuxContainerReorderError, _Record): reorder: _int max: _int codec: _str -@_dataclass(slots=True, repr=False) -class _MuxContainerReorderError_Deepened(MuxContainerReorderError): + def __init__(self, reorder: _int, max: _int, codec: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerReorderError_Deepened(MuxContainerReorderError, _Record): declared: _int reorder: _int -@_dataclass(slots=True, repr=False) -class _MuxContainerReorderError_Reordered(MuxContainerReorderError): + def __init__(self, declared: _int, reorder: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerReorderError_Reordered(MuxContainerReorderError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _MuxContainerReorderError_Presentation(MuxContainerReorderError): - ... -@_dataclass(slots=True, repr=False) -class _MuxContainerReorderError_Tie(MuxContainerReorderError): - ... -@_dataclass(slots=True, repr=False) -class _MuxContainerReorderError_Undrained(MuxContainerReorderError): - ... + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerReorderError_Presentation(MuxContainerReorderError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerReorderError_Tie(MuxContainerReorderError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerReorderError_Undrained(MuxContainerReorderError, _Record): + def __eq__(self, other: _object) -> _bool: ... class MuxImportAudioFormat(_enum.Enum): AAC = 0 OPUS = 1 @@ -1320,15 +1322,18 @@ class MuxImportFormat: Audio: _typing.TypeAlias = '_MuxImportFormat_Audio' Video: _typing.TypeAlias = '_MuxImportFormat_Video' Container: _typing.TypeAlias = '_MuxImportFormat_Container' -@_dataclass(slots=True, repr=False) -class _MuxImportFormat_Audio(MuxImportFormat): +class _MuxImportFormat_Audio(MuxImportFormat, _Record): _0: MuxImportAudioFormat -@_dataclass(slots=True, repr=False) -class _MuxImportFormat_Video(MuxImportFormat): + def __init__(self, _0: MuxImportAudioFormat) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxImportFormat_Video(MuxImportFormat, _Record): _0: MuxImportVideoFormat -@_dataclass(slots=True, repr=False) -class _MuxImportFormat_Container(MuxImportFormat): + def __init__(self, _0: MuxImportVideoFormat) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxImportFormat_Container(MuxImportFormat, _Record): _0: MuxImportContainerFormat + def __init__(self, _0: MuxImportContainerFormat) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class MuxImportKind(_enum.Enum): AUDIO = 0 VIDEO = 1 @@ -1349,25 +1354,27 @@ class MuxRateTarget: def __repr__(self) -> _str: ... Enabled: _typing.TypeAlias = '_MuxRateTarget_Enabled' Disabled: _typing.TypeAlias = '_MuxRateTarget_Disabled' -@_dataclass(slots=True, repr=False) -class _MuxRateTarget_Enabled(MuxRateTarget): +class _MuxRateTarget_Enabled(MuxRateTarget, _Record): _0: BandwidthRate -@_dataclass(slots=True, repr=False) -class _MuxRateTarget_Disabled(MuxRateTarget): - ... + def __init__(self, _0: BandwidthRate) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxRateTarget_Disabled(MuxRateTarget, _Record): + def __eq__(self, other: _object) -> _bool: ... class TokioListenBind: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... def resolve(self) -> _tuple[_str, _int] | _tuple[_str, _int, _int, _int]: ... Addr: _typing.TypeAlias = '_TokioListenBind_Addr' Host: _typing.TypeAlias = '_TokioListenBind_Host' -@_dataclass(slots=True, repr=False) -class _TokioListenBind_Addr(TokioListenBind): +class _TokioListenBind_Addr(TokioListenBind, _Record): _0: _tuple[_str, _int] | _tuple[_str, _int, _int, _int] -@_dataclass(slots=True, repr=False) -class _TokioListenBind_Host(TokioListenBind): + def __init__(self, _0: _tuple[_str, _int] | _tuple[_str, _int, _int, _int]) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _TokioListenBind_Host(TokioListenBind, _Record): _0: _str _1: _int + def __init__(self, _0: _str, _1: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class TransportMemoryError: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @@ -1375,19 +1382,21 @@ class TransportMemoryError: Reset: _typing.TypeAlias = '_TransportMemoryError_Reset' Stopped: _typing.TypeAlias = '_TransportMemoryError_Stopped' Closed: _typing.TypeAlias = '_TransportMemoryError_Closed' -@_dataclass(slots=True, repr=False) -class _TransportMemoryError_Session(TransportMemoryError): +class _TransportMemoryError_Session(TransportMemoryError, _Record): code: _int reason: _str -@_dataclass(slots=True, repr=False) -class _TransportMemoryError_Reset(TransportMemoryError): + def __init__(self, code: _int, reason: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _TransportMemoryError_Reset(TransportMemoryError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _TransportMemoryError_Stopped(TransportMemoryError): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _TransportMemoryError_Stopped(TransportMemoryError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _TransportMemoryError_Closed(TransportMemoryError): - ... + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _TransportMemoryError_Closed(TransportMemoryError, _Record): + def __eq__(self, other: _object) -> _bool: ... class TransportPollAcked(_enum.Enum): DELIVERED = 0 UNSUPPORTED = 1 @@ -1417,74 +1426,91 @@ class MuxCatalogMsfError: MalformedInitSegment: _typing.TypeAlias = '_MuxCatalogMsfError_MalformedInitSegment' MissingInitMoov: _typing.TypeAlias = '_MuxCatalogMsfError_MissingInitMoov' MissingAudioSampleEntry: _typing.TypeAlias = '_MuxCatalogMsfError_MissingAudioSampleEntry' -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_UnresolvableNamespace(MuxCatalogMsfError): +class _MuxCatalogMsfError_UnresolvableNamespace(MuxCatalogMsfError, _Record): name: _str namespace: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_InvalidUtf8(MuxCatalogMsfError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_ParseFrame(MuxCatalogMsfError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MissingCmafInit(MuxCatalogMsfError): + def __init__(self, name: _str, namespace: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_InvalidUtf8(MuxCatalogMsfError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_ParseFrame(MuxCatalogMsfError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MissingCmafInit(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MalformedInitData(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MalformedInitData(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MissingVideoCodec(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MissingVideoCodec(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MissingAudioCodec(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MissingAudioCodec(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_UnsupportedPackaging(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_UnsupportedPackaging(MuxCatalogMsfError, _Record): name: _str packaging: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MissingTextCodec(MuxCatalogMsfError): + def __init__(self, name: _str, packaging: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MissingTextCodec(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_InvalidVideoCodec(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_InvalidVideoCodec(MuxCatalogMsfError, _Record): name: _str codec: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_InvalidAudioCodec(MuxCatalogMsfError): + def __init__(self, name: _str, codec: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_InvalidAudioCodec(MuxCatalogMsfError, _Record): name: _str codec: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MissingAudioParams(MuxCatalogMsfError): + def __init__(self, name: _str, codec: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MissingAudioParams(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_UnsupportedDerivationPackaging(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_UnsupportedDerivationPackaging(MuxCatalogMsfError, _Record): name: _str packaging: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MalformedAac(MuxCatalogMsfError): + def __init__(self, name: _str, packaging: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MalformedAac(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MalformedOpus(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MalformedOpus(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MalformedFlac(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MalformedFlac(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_OpusTrailingBytes(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_OpusTrailingBytes(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_UnsupportedDerivationCodec(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_UnsupportedDerivationCodec(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MalformedInitSegment(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MalformedInitSegment(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MissingInitMoov(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MissingInitMoov(MuxCatalogMsfError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MuxCatalogMsfError_MissingAudioSampleEntry(MuxCatalogMsfError): + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCatalogMsfError_MissingAudioSampleEntry(MuxCatalogMsfError, _Record): _0: _str + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class MuxCodecFlacError(_enum.Enum): SHORT = 0 INVALID_MARKER = 1 @@ -1509,27 +1535,26 @@ class MuxCodecOpusError: MappingTableTooShort: _typing.TypeAlias = '_MuxCodecOpusError_MappingTableTooShort' InvalidMappingTable: _typing.TypeAlias = '_MuxCodecOpusError_InvalidMappingTable' UnsupportedMappingFamily: _typing.TypeAlias = '_MuxCodecOpusError_UnsupportedMappingFamily' -@_dataclass(slots=True, repr=False) -class _MuxCodecOpusError_HeadTooShort(MuxCodecOpusError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCodecOpusError_InvalidSignature(MuxCodecOpusError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCodecOpusError_UnsupportedVersion(MuxCodecOpusError): +class _MuxCodecOpusError_HeadTooShort(MuxCodecOpusError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecOpusError_InvalidSignature(MuxCodecOpusError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecOpusError_UnsupportedVersion(MuxCodecOpusError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _MuxCodecOpusError_UnsupportedChannelCount(MuxCodecOpusError): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecOpusError_UnsupportedChannelCount(MuxCodecOpusError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _MuxCodecOpusError_MappingTableTooShort(MuxCodecOpusError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCodecOpusError_InvalidMappingTable(MuxCodecOpusError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCodecOpusError_UnsupportedMappingFamily(MuxCodecOpusError): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecOpusError_MappingTableTooShort(MuxCodecOpusError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecOpusError_InvalidMappingTable(MuxCodecOpusError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecOpusError_UnsupportedMappingFamily(MuxCodecOpusError, _Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class MuxCodecVp8Error(_enum.Enum): FRAME_TOO_SHORT = 0 KEYFRAME_HEADER_TOO_SHORT = 1 @@ -1552,12 +1577,14 @@ class MuxContainerFmp4Chunk: def fragment(self) -> MuxContainerFmp4Fragment | None: ... Init: _typing.TypeAlias = '_MuxContainerFmp4Chunk_Init' Fragment: _typing.TypeAlias = '_MuxContainerFmp4Chunk_Fragment' -@_dataclass(slots=True, repr=False) -class _MuxContainerFmp4Chunk_Init(MuxContainerFmp4Chunk): +class _MuxContainerFmp4Chunk_Init(MuxContainerFmp4Chunk, _Record): _0: _bytes | _bytearray | _memoryview -@_dataclass(slots=True, repr=False) -class _MuxContainerFmp4Chunk_Fragment(MuxContainerFmp4Chunk): + def __init__(self, _0: _bytes | _bytearray | _memoryview) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerFmp4Chunk_Fragment(MuxContainerFmp4Chunk, _Record): _0: MuxContainerFmp4Fragment + def __init__(self, _0: MuxContainerFmp4Fragment) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class MuxContainerTsFraming(_enum.Enum): SECTION = 0 def __repr__(self) -> _str: ... @@ -1569,17 +1596,20 @@ class MuxContainerTsStep: Rewind: _typing.TypeAlias = '_MuxContainerTsStep_Rewind' Leap: _typing.TypeAlias = '_MuxContainerTsStep_Leap' Identity: _typing.TypeAlias = '_MuxContainerTsStep_Identity' -@_dataclass(slots=True, repr=False) -class _MuxContainerTsStep_Rewind(MuxContainerTsStep): +class _MuxContainerTsStep_Rewind(MuxContainerTsStep, _Record): by: Duration flagged: _bool -@_dataclass(slots=True, repr=False) -class _MuxContainerTsStep_Leap(MuxContainerTsStep): + def __init__(self, by: Duration, flagged: _bool) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerTsStep_Leap(MuxContainerTsStep, _Record): by: Duration -@_dataclass(slots=True, repr=False) -class _MuxContainerTsStep_Identity(MuxContainerTsStep): + def __init__(self, by: Duration) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxContainerTsStep_Identity(MuxContainerTsStep, _Record): transport_stream_id: _int program_number: _int + def __init__(self, transport_stream_id: _int, program_number: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class MuxCodecAacAdtsError: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... @@ -1592,33 +1622,32 @@ class MuxCodecAacAdtsError: Rate: _typing.TypeAlias = '_MuxCodecAacAdtsError_Rate' ChannelConfig: _typing.TypeAlias = '_MuxCodecAacAdtsError_ChannelConfig' TooLarge: _typing.TypeAlias = '_MuxCodecAacAdtsError_TooLarge' -@_dataclass(slots=True, repr=False) -class _MuxCodecAacAdtsError_Truncated(MuxCodecAacAdtsError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCodecAacAdtsError_Syncword(MuxCodecAacAdtsError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCodecAacAdtsError_SampleRate(MuxCodecAacAdtsError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCodecAacAdtsError_FrameLength(MuxCodecAacAdtsError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCodecAacAdtsError_PacketLength(MuxCodecAacAdtsError): - ... -@_dataclass(slots=True, repr=False) -class _MuxCodecAacAdtsError_ObjectType(MuxCodecAacAdtsError): +class _MuxCodecAacAdtsError_Truncated(MuxCodecAacAdtsError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecAacAdtsError_Syncword(MuxCodecAacAdtsError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecAacAdtsError_SampleRate(MuxCodecAacAdtsError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecAacAdtsError_FrameLength(MuxCodecAacAdtsError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecAacAdtsError_PacketLength(MuxCodecAacAdtsError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecAacAdtsError_ObjectType(MuxCodecAacAdtsError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _MuxCodecAacAdtsError_Rate(MuxCodecAacAdtsError): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecAacAdtsError_Rate(MuxCodecAacAdtsError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _MuxCodecAacAdtsError_ChannelConfig(MuxCodecAacAdtsError): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecAacAdtsError_ChannelConfig(MuxCodecAacAdtsError, _Record): _0: _int -@_dataclass(slots=True, repr=False) -class _MuxCodecAacAdtsError_TooLarge(MuxCodecAacAdtsError): + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MuxCodecAacAdtsError_TooLarge(MuxCodecAacAdtsError, _Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class MuxContainerTsStatsClass(_enum.Enum): AUDIO = 1 VIDEO = 2 @@ -1653,27 +1682,26 @@ class MoqQuicRate: def __repr__(self) -> _str: ... Unlimited: _typing.TypeAlias = '_MoqQuicRate_Unlimited' BytesPerSecond: _typing.TypeAlias = '_MoqQuicRate_BytesPerSecond' -@_dataclass(slots=True, repr=False) -class _MoqQuicRate_Unlimited(MoqQuicRate): - ... -@_dataclass(slots=True, repr=False) -class _MoqQuicRate_BytesPerSecond(MoqQuicRate): +class _MoqQuicRate_Unlimited(MoqQuicRate, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MoqQuicRate_BytesPerSecond(MoqQuicRate, _Record): _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... class MoqTokioConnectError: def __str__(self) -> _str: ... def __repr__(self) -> _str: ... EmptyAddresses: _typing.TypeAlias = '_MoqTokioConnectError_EmptyAddresses' UnsupportedScheme: _typing.TypeAlias = '_MoqTokioConnectError_UnsupportedScheme' MissingHost: _typing.TypeAlias = '_MoqTokioConnectError_MissingHost' -@_dataclass(slots=True, repr=False) -class _MoqTokioConnectError_EmptyAddresses(MoqTokioConnectError): - ... -@_dataclass(slots=True, repr=False) -class _MoqTokioConnectError_UnsupportedScheme(MoqTokioConnectError): +class _MoqTokioConnectError_EmptyAddresses(MoqTokioConnectError, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _MoqTokioConnectError_UnsupportedScheme(MoqTokioConnectError, _Record): _0: _str -@_dataclass(slots=True, repr=False) -class _MoqTokioConnectError_MissingHost(MoqTokioConnectError): - ... + def __init__(self, _0: _str) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class _MoqTokioConnectError_MissingHost(MoqTokioConnectError, _Record): + def __eq__(self, other: _object) -> _bool: ... class RustlsProtocolVersion: def __repr__(self) -> _str: ... def to_array(self) -> ArrayU8x2: ... @@ -1688,38 +1716,30 @@ class RustlsProtocolVersion: DtlSv12: _typing.TypeAlias = '_RustlsProtocolVersion_DtlSv12' DtlSv13: _typing.TypeAlias = '_RustlsProtocolVersion_DtlSv13' Unknown: _typing.TypeAlias = '_RustlsProtocolVersion_Unknown' -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_SsLv2(RustlsProtocolVersion): - ... -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_SsLv3(RustlsProtocolVersion): - ... -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_TlSv10(RustlsProtocolVersion): - ... -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_TlSv11(RustlsProtocolVersion): - ... -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_TlSv12(RustlsProtocolVersion): - ... -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_TlSv13(RustlsProtocolVersion): - ... -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_DtlSv10(RustlsProtocolVersion): - ... -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_DtlSv12(RustlsProtocolVersion): - ... -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_DtlSv13(RustlsProtocolVersion): - ... -@_dataclass(slots=True, repr=False) -class _RustlsProtocolVersion_Unknown(RustlsProtocolVersion): - _0: _int -class RustlsClientTls12Resumption(_enum.Enum): - DISABLED = 0 +class _RustlsProtocolVersion_SsLv2(RustlsProtocolVersion, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _RustlsProtocolVersion_SsLv3(RustlsProtocolVersion, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _RustlsProtocolVersion_TlSv10(RustlsProtocolVersion, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _RustlsProtocolVersion_TlSv11(RustlsProtocolVersion, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _RustlsProtocolVersion_TlSv12(RustlsProtocolVersion, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _RustlsProtocolVersion_TlSv13(RustlsProtocolVersion, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _RustlsProtocolVersion_DtlSv10(RustlsProtocolVersion, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _RustlsProtocolVersion_DtlSv12(RustlsProtocolVersion, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _RustlsProtocolVersion_DtlSv13(RustlsProtocolVersion, _Record): + def __eq__(self, other: _object) -> _bool: ... +class _RustlsProtocolVersion_Unknown(RustlsProtocolVersion, _Record): + _0: _int + def __init__(self, _0: _int) -> None: ... + def __eq__(self, other: _object) -> _bool: ... +class RustlsClientTls12Resumption(_enum.Enum): + DISABLED = 0 SESSION_ID_ONLY = 1 SESSION_ID_OR_TICKETS = 2 def __repr__(self) -> _str: ... @@ -7908,71 +7928,642 @@ class ClockElapsedException(_Exception): def __init__(self, error: ClockElapsed) -> None: ... def __str__(self) -> _str: ... class DecodeErrorException(_Exception): + def __new__(cls, error: DecodeError) -> _typing.Self: ... def __init__(self, error: DecodeError) -> None: ... def __str__(self) -> _str: ... + Short: _typing.TypeAlias = '_DecodeErrorException_Short' + Long: _typing.TypeAlias = '_DecodeErrorException_Long' + InvalidString: _typing.TypeAlias = '_DecodeErrorException_InvalidString' + InvalidMessage: _typing.TypeAlias = '_DecodeErrorException_InvalidMessage' + InvalidSubscribeLocation: _typing.TypeAlias = '_DecodeErrorException_InvalidSubscribeLocation' + InvalidValue: _typing.TypeAlias = '_DecodeErrorException_InvalidValue' + TooMany: _typing.TypeAlias = '_DecodeErrorException_TooMany' + BoundsExceeded: _typing.TypeAlias = '_DecodeErrorException_BoundsExceeded' + ExpectedEnd: _typing.TypeAlias = '_DecodeErrorException_ExpectedEnd' + MessageTooLarge: _typing.TypeAlias = '_DecodeErrorException_MessageTooLarge' + Duplicate: _typing.TypeAlias = '_DecodeErrorException_Duplicate' + TrailingBytes: _typing.TypeAlias = '_DecodeErrorException_TrailingBytes' + Version: _typing.TypeAlias = '_DecodeErrorException_Version' + Session: _typing.TypeAlias = '_DecodeErrorException_Session' + MalformedAuthToken: _typing.TypeAlias = '_DecodeErrorException_MalformedAuthToken' + MultipleAuthTokens: _typing.TypeAlias = '_DecodeErrorException_MultipleAuthTokens' +class _DecodeErrorException_Short(DecodeErrorException): + ... +class _DecodeErrorException_Long(DecodeErrorException): + ... +class _DecodeErrorException_InvalidString(DecodeErrorException): + ... +class _DecodeErrorException_InvalidMessage(DecodeErrorException): + ... +class _DecodeErrorException_InvalidSubscribeLocation(DecodeErrorException): + ... +class _DecodeErrorException_InvalidValue(DecodeErrorException): + ... +class _DecodeErrorException_TooMany(DecodeErrorException): + ... +class _DecodeErrorException_BoundsExceeded(DecodeErrorException): + ... +class _DecodeErrorException_ExpectedEnd(DecodeErrorException): + ... +class _DecodeErrorException_MessageTooLarge(DecodeErrorException): + ... +class _DecodeErrorException_Duplicate(DecodeErrorException): + ... +class _DecodeErrorException_TrailingBytes(DecodeErrorException): + ... +class _DecodeErrorException_Version(DecodeErrorException): + ... +class _DecodeErrorException_Session(DecodeErrorException): + ... +class _DecodeErrorException_MalformedAuthToken(DecodeErrorException): + ... +class _DecodeErrorException_MultipleAuthTokens(DecodeErrorException): + ... class EncodeErrorException(_Exception): + def __new__(cls, error: EncodeError) -> _typing.Self: ... def __init__(self, error: EncodeError) -> None: ... def __str__(self) -> _str: ... + BoundsExceeded: _typing.TypeAlias = '_EncodeErrorException_BoundsExceeded' + TooLarge: _typing.TypeAlias = '_EncodeErrorException_TooLarge' + Short: _typing.TypeAlias = '_EncodeErrorException_Short' + InvalidState: _typing.TypeAlias = '_EncodeErrorException_InvalidState' + TooMany: _typing.TypeAlias = '_EncodeErrorException_TooMany' + Version: _typing.TypeAlias = '_EncodeErrorException_Version' + Unsupported: _typing.TypeAlias = '_EncodeErrorException_Unsupported' +class _EncodeErrorException_BoundsExceeded(EncodeErrorException): + ... +class _EncodeErrorException_TooLarge(EncodeErrorException): + ... +class _EncodeErrorException_Short(EncodeErrorException): + ... +class _EncodeErrorException_InvalidState(EncodeErrorException): + ... +class _EncodeErrorException_TooMany(EncodeErrorException): + ... +class _EncodeErrorException_Version(EncodeErrorException): + ... +class _EncodeErrorException_Unsupported(EncodeErrorException): + ... class ErrorException(_Exception): + def __new__(cls, error: Error) -> _typing.Self: ... def __init__(self, error: Error) -> None: ... def __str__(self) -> _str: ... + Transport: _typing.TypeAlias = '_ErrorException_Transport' + Decode: _typing.TypeAlias = '_ErrorException_Decode' + Version: _typing.TypeAlias = '_ErrorException_Version' + UnexpectedStream: _typing.TypeAlias = '_ErrorException_UnexpectedStream' + BoundsExceeded: _typing.TypeAlias = '_ErrorException_BoundsExceeded' + InvalidPath: _typing.TypeAlias = '_ErrorException_InvalidPath' + NavigationSegment: _typing.TypeAlias = '_ErrorException_NavigationSegment' + Path: _typing.TypeAlias = '_ErrorException_Path' + Duplicate: _typing.TypeAlias = '_ErrorException_Duplicate' + Skipped: _typing.TypeAlias = '_ErrorException_Skipped' + Cancel: _typing.TypeAlias = '_ErrorException_Cancel' + Timeout: _typing.TypeAlias = '_ErrorException_Timeout' + Old: _typing.TypeAlias = '_ErrorException_Old' + App: _typing.TypeAlias = '_ErrorException_App' + NotFound: _typing.TypeAlias = '_ErrorException_NotFound' + InvalidJoiningRequestId: _typing.TypeAlias = '_ErrorException_InvalidJoiningRequestId' + InvalidRange: _typing.TypeAlias = '_ErrorException_InvalidRange' + Unroutable: _typing.TypeAlias = '_ErrorException_Unroutable' + WrongSize: _typing.TypeAlias = '_ErrorException_WrongSize' + ProtocolViolation: _typing.TypeAlias = '_ErrorException_ProtocolViolation' + Unauthorized: _typing.TypeAlias = '_ErrorException_Unauthorized' + Expired: _typing.TypeAlias = '_ErrorException_Expired' + UnexpectedMessage: _typing.TypeAlias = '_ErrorException_UnexpectedMessage' + Unsupported: _typing.TypeAlias = '_ErrorException_Unsupported' + Encode: _typing.TypeAlias = '_ErrorException_Encode' + TooManyRequests: _typing.TypeAlias = '_ErrorException_TooManyRequests' + UnknownAlpn: _typing.TypeAlias = '_ErrorException_UnknownAlpn' + Dropped: _typing.TypeAlias = '_ErrorException_Dropped' + Closed: _typing.TypeAlias = '_ErrorException_Closed' + Lagged: _typing.TypeAlias = '_ErrorException_Lagged' + FrameTooLarge: _typing.TypeAlias = '_ErrorException_FrameTooLarge' + GroupTooLarge: _typing.TypeAlias = '_ErrorException_GroupTooLarge' + TimestampMismatch: _typing.TypeAlias = '_ErrorException_TimestampMismatch' + Evicted: _typing.TypeAlias = '_ErrorException_Evicted' + GoingAway: _typing.TypeAlias = '_ErrorException_GoingAway' + GoawayTimeout: _typing.TypeAlias = '_ErrorException_GoawayTimeout' + MalformedTrack: _typing.TypeAlias = '_ErrorException_MalformedTrack' + UnsupportedExtension: _typing.TypeAlias = '_ErrorException_UnsupportedExtension' + Session: _typing.TypeAlias = '_ErrorException_Session' + Stream: _typing.TypeAlias = '_ErrorException_Stream' + Remote: _typing.TypeAlias = '_ErrorException_Remote' + IdleTimeout: _typing.TypeAlias = '_ErrorException_IdleTimeout' +class _ErrorException_Transport(ErrorException): + ... +class _ErrorException_Decode(ErrorException): + ... +class _ErrorException_Version(ErrorException): + ... +class _ErrorException_UnexpectedStream(ErrorException): + ... +class _ErrorException_BoundsExceeded(ErrorException): + ... +class _ErrorException_InvalidPath(ErrorException): + ... +class _ErrorException_NavigationSegment(ErrorException): + ... +class _ErrorException_Path(ErrorException): + ... +class _ErrorException_Duplicate(ErrorException): + ... +class _ErrorException_Skipped(ErrorException): + ... +class _ErrorException_Cancel(ErrorException): + ... +class _ErrorException_Timeout(ErrorException): + ... +class _ErrorException_Old(ErrorException): + ... +class _ErrorException_App(ErrorException): + ... +class _ErrorException_NotFound(ErrorException): + ... +class _ErrorException_InvalidJoiningRequestId(ErrorException): + ... +class _ErrorException_InvalidRange(ErrorException): + ... +class _ErrorException_Unroutable(ErrorException): + ... +class _ErrorException_WrongSize(ErrorException): + ... +class _ErrorException_ProtocolViolation(ErrorException): + ... +class _ErrorException_Unauthorized(ErrorException): + ... +class _ErrorException_Expired(ErrorException): + ... +class _ErrorException_UnexpectedMessage(ErrorException): + ... +class _ErrorException_Unsupported(ErrorException): + ... +class _ErrorException_Encode(ErrorException): + ... +class _ErrorException_TooManyRequests(ErrorException): + ... +class _ErrorException_UnknownAlpn(ErrorException): + ... +class _ErrorException_Dropped(ErrorException): + ... +class _ErrorException_Closed(ErrorException): + ... +class _ErrorException_Lagged(ErrorException): + ... +class _ErrorException_FrameTooLarge(ErrorException): + ... +class _ErrorException_GroupTooLarge(ErrorException): + ... +class _ErrorException_TimestampMismatch(ErrorException): + ... +class _ErrorException_Evicted(ErrorException): + ... +class _ErrorException_GoingAway(ErrorException): + ... +class _ErrorException_GoawayTimeout(ErrorException): + ... +class _ErrorException_MalformedTrack(ErrorException): + ... +class _ErrorException_UnsupportedExtension(ErrorException): + ... +class _ErrorException_Session(ErrorException): + ... +class _ErrorException_Stream(ErrorException): + ... +class _ErrorException_Remote(ErrorException): + ... +class _ErrorException_IdleTimeout(ErrorException): + ... class HangErrorException(_Exception): + def __new__(cls, error: HangError) -> _typing.Self: ... def __init__(self, error: HangError) -> None: ... def __str__(self) -> _str: ... + Moq: _typing.TypeAlias = '_HangErrorException_Moq' + Json: _typing.TypeAlias = '_HangErrorException_Json' + DuplicateRendition: _typing.TypeAlias = '_HangErrorException_DuplicateRendition' + UnsupportedVersion: _typing.TypeAlias = '_HangErrorException_UnsupportedVersion' + EscapingBroadcast: _typing.TypeAlias = '_HangErrorException_EscapingBroadcast' + InvalidCodec: _typing.TypeAlias = '_HangErrorException_InvalidCodec' + ExpectedInt: _typing.TypeAlias = '_HangErrorException_ExpectedInt' + Hex: _typing.TypeAlias = '_HangErrorException_Hex' + TimestampOverflow: _typing.TypeAlias = '_HangErrorException_TimestampOverflow' + MissingKeyframe: _typing.TypeAlias = '_HangErrorException_MissingKeyframe' + TimestampBackwards: _typing.TypeAlias = '_HangErrorException_TimestampBackwards' + Url: _typing.TypeAlias = '_HangErrorException_Url' + EmptyGroup: _typing.TypeAlias = '_HangErrorException_EmptyGroup' + UnknownFormat: _typing.TypeAlias = '_HangErrorException_UnknownFormat' + Duplicate: _typing.TypeAlias = '_HangErrorException_Duplicate' + InvalidTimescale: _typing.TypeAlias = '_HangErrorException_InvalidTimescale' + InvalidWall: _typing.TypeAlias = '_HangErrorException_InvalidWall' + InvalidVideoRotation: _typing.TypeAlias = '_HangErrorException_InvalidVideoRotation' + InvalidFieldOfView: _typing.TypeAlias = '_HangErrorException_InvalidFieldOfView' + InvalidAmbisonicChannels: _typing.TypeAlias = '_HangErrorException_InvalidAmbisonicChannels' + Zero: _typing.TypeAlias = '_HangErrorException_Zero' +class _HangErrorException_Moq(HangErrorException): + ... +class _HangErrorException_Json(HangErrorException): + ... +class _HangErrorException_DuplicateRendition(HangErrorException): + ... +class _HangErrorException_UnsupportedVersion(HangErrorException): + ... +class _HangErrorException_EscapingBroadcast(HangErrorException): + ... +class _HangErrorException_InvalidCodec(HangErrorException): + ... +class _HangErrorException_ExpectedInt(HangErrorException): + ... +class _HangErrorException_Hex(HangErrorException): + ... +class _HangErrorException_TimestampOverflow(HangErrorException): + ... +class _HangErrorException_MissingKeyframe(HangErrorException): + ... +class _HangErrorException_TimestampBackwards(HangErrorException): + ... +class _HangErrorException_Url(HangErrorException): + ... +class _HangErrorException_EmptyGroup(HangErrorException): + ... +class _HangErrorException_UnknownFormat(HangErrorException): + ... +class _HangErrorException_Duplicate(HangErrorException): + ... +class _HangErrorException_InvalidTimescale(HangErrorException): + ... +class _HangErrorException_InvalidWall(HangErrorException): + ... +class _HangErrorException_InvalidVideoRotation(HangErrorException): + ... +class _HangErrorException_InvalidFieldOfView(HangErrorException): + ... +class _HangErrorException_InvalidAmbisonicChannels(HangErrorException): + ... +class _HangErrorException_Zero(HangErrorException): + ... class IntersectionErrorException(_Exception): + def __new__(cls, error: IntersectionError) -> _typing.Self: ... def __init__(self, error: IntersectionError) -> None: ... def __str__(self) -> _str: ... + TooManyPatterns: _typing.TypeAlias = '_IntersectionErrorException_TooManyPatterns' +class _IntersectionErrorException_TooManyPatterns(IntersectionErrorException): + ... class InvalidPatternException(_Exception): + def __new__(cls, error: InvalidPattern) -> _typing.Self: ... def __init__(self, error: InvalidPattern) -> None: ... def __str__(self) -> _str: ... + EmptySegment: _typing.TypeAlias = '_InvalidPatternException_EmptySegment' + InvalidSegment: _typing.TypeAlias = '_InvalidPatternException_InvalidSegment' + MultipleGlobstars: _typing.TypeAlias = '_InvalidPatternException_MultipleGlobstars' + TooManySegments: _typing.TypeAlias = '_InvalidPatternException_TooManySegments' +class _InvalidPatternException_EmptySegment(InvalidPatternException): + ... +class _InvalidPatternException_InvalidSegment(InvalidPatternException): + ... +class _InvalidPatternException_MultipleGlobstars(InvalidPatternException): + ... +class _InvalidPatternException_TooManySegments(InvalidPatternException): + ... class MoqTokioConnectErrorException(_Exception): + def __new__(cls, error: MoqTokioConnectError) -> _typing.Self: ... def __init__(self, error: MoqTokioConnectError) -> None: ... def __str__(self) -> _str: ... + EmptyAddresses: _typing.TypeAlias = '_MoqTokioConnectErrorException_EmptyAddresses' + UnsupportedScheme: _typing.TypeAlias = '_MoqTokioConnectErrorException_UnsupportedScheme' + MissingHost: _typing.TypeAlias = '_MoqTokioConnectErrorException_MissingHost' +class _MoqTokioConnectErrorException_EmptyAddresses(MoqTokioConnectErrorException): + ... +class _MoqTokioConnectErrorException_UnsupportedScheme(MoqTokioConnectErrorException): + ... +class _MoqTokioConnectErrorException_MissingHost(MoqTokioConnectErrorException): + ... class MoqTokioWebsocketErrorException(_Exception): + def __new__(cls, error: MoqTokioWebsocketError) -> _typing.Self: ... def __init__(self, error: MoqTokioWebsocketError) -> None: ... def __str__(self) -> _str: ... + Failover: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_Failover' + Io: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_Io' + Disabled: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_Disabled' + MissingHostname: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_MissingHostname' + Tls: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_Tls' + UnsupportedScheme: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_UnsupportedScheme' + Connect: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_Connect' + BuildRequest: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_BuildRequest' + ProtocolHeader: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_ProtocolHeader' + WebSocketConnect: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_WebSocketConnect' + ConnectRejected: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_ConnectRejected' + Accept: _typing.TypeAlias = '_MoqTokioWebsocketErrorException_Accept' +class _MoqTokioWebsocketErrorException_Failover(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_Io(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_Disabled(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_MissingHostname(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_Tls(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_UnsupportedScheme(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_Connect(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_BuildRequest(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_ProtocolHeader(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_WebSocketConnect(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_ConnectRejected(MoqTokioWebsocketErrorException): + ... +class _MoqTokioWebsocketErrorException_Accept(MoqTokioWebsocketErrorException): + ... class MuxCodecAacAdtsErrorException(_Exception): + def __new__(cls, error: MuxCodecAacAdtsError) -> _typing.Self: ... def __init__(self, error: MuxCodecAacAdtsError) -> None: ... def __str__(self) -> _str: ... + Truncated: _typing.TypeAlias = '_MuxCodecAacAdtsErrorException_Truncated' + Syncword: _typing.TypeAlias = '_MuxCodecAacAdtsErrorException_Syncword' + SampleRate: _typing.TypeAlias = '_MuxCodecAacAdtsErrorException_SampleRate' + FrameLength: _typing.TypeAlias = '_MuxCodecAacAdtsErrorException_FrameLength' + PacketLength: _typing.TypeAlias = '_MuxCodecAacAdtsErrorException_PacketLength' + ObjectType: _typing.TypeAlias = '_MuxCodecAacAdtsErrorException_ObjectType' + Rate: _typing.TypeAlias = '_MuxCodecAacAdtsErrorException_Rate' + ChannelConfig: _typing.TypeAlias = '_MuxCodecAacAdtsErrorException_ChannelConfig' + TooLarge: _typing.TypeAlias = '_MuxCodecAacAdtsErrorException_TooLarge' +class _MuxCodecAacAdtsErrorException_Truncated(MuxCodecAacAdtsErrorException): + ... +class _MuxCodecAacAdtsErrorException_Syncword(MuxCodecAacAdtsErrorException): + ... +class _MuxCodecAacAdtsErrorException_SampleRate(MuxCodecAacAdtsErrorException): + ... +class _MuxCodecAacAdtsErrorException_FrameLength(MuxCodecAacAdtsErrorException): + ... +class _MuxCodecAacAdtsErrorException_PacketLength(MuxCodecAacAdtsErrorException): + ... +class _MuxCodecAacAdtsErrorException_ObjectType(MuxCodecAacAdtsErrorException): + ... +class _MuxCodecAacAdtsErrorException_Rate(MuxCodecAacAdtsErrorException): + ... +class _MuxCodecAacAdtsErrorException_ChannelConfig(MuxCodecAacAdtsErrorException): + ... +class _MuxCodecAacAdtsErrorException_TooLarge(MuxCodecAacAdtsErrorException): + ... class MuxCodecAacErrorException(_Exception): + def __new__(cls, error: MuxCodecAacError) -> _typing.Self: ... def __init__(self, error: MuxCodecAacError) -> None: ... def __str__(self) -> _str: ... + ConfigTooShort: _typing.TypeAlias = '_MuxCodecAacErrorException_ConfigTooShort' + ExtendedConfigTooShort: _typing.TypeAlias = '_MuxCodecAacErrorException_ExtendedConfigTooShort' + IncompleteConfig: _typing.TypeAlias = '_MuxCodecAacErrorException_IncompleteConfig' + ExplicitSampleRateTooShort: _typing.TypeAlias = '_MuxCodecAacErrorException_ExplicitSampleRateTooShort' + UnsupportedSampleRateIndex: _typing.TypeAlias = '_MuxCodecAacErrorException_UnsupportedSampleRateIndex' + ReservedChannelConfig: _typing.TypeAlias = '_MuxCodecAacErrorException_ReservedChannelConfig' + UnsupportedChannelCount: _typing.TypeAlias = '_MuxCodecAacErrorException_UnsupportedChannelCount' + ProgramConfigUnsupported: _typing.TypeAlias = '_MuxCodecAacErrorException_ProgramConfigUnsupported' + ProgramConfigMissing: _typing.TypeAlias = '_MuxCodecAacErrorException_ProgramConfigMissing' + ProgramConfigTruncated: _typing.TypeAlias = '_MuxCodecAacErrorException_ProgramConfigTruncated' + ProgramConfigEmpty: _typing.TypeAlias = '_MuxCodecAacErrorException_ProgramConfigEmpty' + MissingDescription: _typing.TypeAlias = '_MuxCodecAacErrorException_MissingDescription' + UnsupportedConfig: _typing.TypeAlias = '_MuxCodecAacErrorException_UnsupportedConfig' + TrailingBytes: _typing.TypeAlias = '_MuxCodecAacErrorException_TrailingBytes' + Adts: _typing.TypeAlias = '_MuxCodecAacErrorException_Adts' +class _MuxCodecAacErrorException_ConfigTooShort(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_ExtendedConfigTooShort(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_IncompleteConfig(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_ExplicitSampleRateTooShort(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_UnsupportedSampleRateIndex(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_ReservedChannelConfig(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_UnsupportedChannelCount(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_ProgramConfigUnsupported(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_ProgramConfigMissing(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_ProgramConfigTruncated(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_ProgramConfigEmpty(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_MissingDescription(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_UnsupportedConfig(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_TrailingBytes(MuxCodecAacErrorException): + ... +class _MuxCodecAacErrorException_Adts(MuxCodecAacErrorException): + ... class MuxCodecAacImportException(_Exception): def __init__(self, error: MuxCodecAacImport) -> None: ... def __str__(self) -> _str: ... class MuxCodecAnnexbErrorException(_Exception): + def __new__(cls, error: MuxCodecAnnexbError) -> _typing.Self: ... def __init__(self, error: MuxCodecAnnexbError) -> None: ... def __str__(self) -> _str: ... + MissingStartCode: _typing.TypeAlias = '_MuxCodecAnnexbErrorException_MissingStartCode' + InvalidStartCode: _typing.TypeAlias = '_MuxCodecAnnexbErrorException_InvalidStartCode' + InvalidLengthSize: _typing.TypeAlias = '_MuxCodecAnnexbErrorException_InvalidLengthSize' + Truncated: _typing.TypeAlias = '_MuxCodecAnnexbErrorException_Truncated' + NalTooLarge: _typing.TypeAlias = '_MuxCodecAnnexbErrorException_NalTooLarge' + MissingParameterSet: _typing.TypeAlias = '_MuxCodecAnnexbErrorException_MissingParameterSet' + ParameterSetId: _typing.TypeAlias = '_MuxCodecAnnexbErrorException_ParameterSetId' +class _MuxCodecAnnexbErrorException_MissingStartCode(MuxCodecAnnexbErrorException): + ... +class _MuxCodecAnnexbErrorException_InvalidStartCode(MuxCodecAnnexbErrorException): + ... +class _MuxCodecAnnexbErrorException_InvalidLengthSize(MuxCodecAnnexbErrorException): + ... +class _MuxCodecAnnexbErrorException_Truncated(MuxCodecAnnexbErrorException): + ... +class _MuxCodecAnnexbErrorException_NalTooLarge(MuxCodecAnnexbErrorException): + ... +class _MuxCodecAnnexbErrorException_MissingParameterSet(MuxCodecAnnexbErrorException): + ... +class _MuxCodecAnnexbErrorException_ParameterSetId(MuxCodecAnnexbErrorException): + ... class MuxCodecAv1ImportException(_Exception): def __init__(self, error: MuxCodecAv1Import) -> None: ... def __str__(self) -> _str: ... class MuxCodecFlacErrorException(_Exception): + def __new__(cls, error: MuxCodecFlacError) -> _typing.Self: ... def __init__(self, error: MuxCodecFlacError) -> None: ... def __str__(self) -> _str: ... + Short: _typing.TypeAlias = '_MuxCodecFlacErrorException_Short' + InvalidMarker: _typing.TypeAlias = '_MuxCodecFlacErrorException_InvalidMarker' + MissingStreamInfo: _typing.TypeAlias = '_MuxCodecFlacErrorException_MissingStreamInfo' +class _MuxCodecFlacErrorException_Short(MuxCodecFlacErrorException): + ... +class _MuxCodecFlacErrorException_InvalidMarker(MuxCodecFlacErrorException): + ... +class _MuxCodecFlacErrorException_MissingStreamInfo(MuxCodecFlacErrorException): + ... class MuxCodecFlacImportException(_Exception): def __init__(self, error: MuxCodecFlacImport) -> None: ... def __str__(self) -> _str: ... class MuxCodecH264ErrorException(_Exception): + def __new__(cls, error: MuxCodecH264Error) -> _typing.Self: ... def __init__(self, error: MuxCodecH264Error) -> None: ... def __str__(self) -> _str: ... + SpsTooShort: _typing.TypeAlias = '_MuxCodecH264ErrorException_SpsTooShort' + SpsParse: _typing.TypeAlias = '_MuxCodecH264ErrorException_SpsParse' + AvccTooShort: _typing.TypeAlias = '_MuxCodecH264ErrorException_AvccTooShort' + AvccTruncated: _typing.TypeAlias = '_MuxCodecH264ErrorException_AvccTruncated' + AvccVersion: _typing.TypeAlias = '_MuxCodecH264ErrorException_AvccVersion' + MissingParamSets: _typing.TypeAlias = '_MuxCodecH264ErrorException_MissingParamSets' + SpsTooLarge: _typing.TypeAlias = '_MuxCodecH264ErrorException_SpsTooLarge' + PpsTooLarge: _typing.TypeAlias = '_MuxCodecH264ErrorException_PpsTooLarge' + MissingSps: _typing.TypeAlias = '_MuxCodecH264ErrorException_MissingSps' + TooManySps: _typing.TypeAlias = '_MuxCodecH264ErrorException_TooManySps' + TooManyPps: _typing.TypeAlias = '_MuxCodecH264ErrorException_TooManyPps' + NalTooLarge: _typing.TypeAlias = '_MuxCodecH264ErrorException_NalTooLarge' + NalTooShort: _typing.TypeAlias = '_MuxCodecH264ErrorException_NalTooShort' + ForbiddenZeroBit: _typing.TypeAlias = '_MuxCodecH264ErrorException_ForbiddenZeroBit' + NotInitialized: _typing.TypeAlias = '_MuxCodecH264ErrorException_NotInitialized' + Avc3TrackNotCreated: _typing.TypeAlias = '_MuxCodecH264ErrorException_Avc3TrackNotCreated' + MissingTimestamp: _typing.TypeAlias = '_MuxCodecH264ErrorException_MissingTimestamp' + Annexb: _typing.TypeAlias = '_MuxCodecH264ErrorException_Annexb' +class _MuxCodecH264ErrorException_SpsTooShort(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_SpsParse(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_AvccTooShort(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_AvccTruncated(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_AvccVersion(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_MissingParamSets(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_SpsTooLarge(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_PpsTooLarge(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_MissingSps(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_TooManySps(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_TooManyPps(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_NalTooLarge(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_NalTooShort(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_ForbiddenZeroBit(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_NotInitialized(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_Avc3TrackNotCreated(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_MissingTimestamp(MuxCodecH264ErrorException): + ... +class _MuxCodecH264ErrorException_Annexb(MuxCodecH264ErrorException): + ... class MuxCodecH264ImportException(_Exception): def __init__(self, error: MuxCodecH264Import) -> None: ... def __str__(self) -> _str: ... class MuxCodecH265ErrorException(_Exception): + def __new__(cls, error: MuxCodecH265Error) -> _typing.Self: ... def __init__(self, error: MuxCodecH265Error) -> None: ... def __str__(self) -> _str: ... + NalTooShort: _typing.TypeAlias = '_MuxCodecH265ErrorException_NalTooShort' + NalTooLargeForHvcc: _typing.TypeAlias = '_MuxCodecH265ErrorException_NalTooLargeForHvcc' + TooManyNals: _typing.TypeAlias = '_MuxCodecH265ErrorException_TooManyNals' + NalTooLarge: _typing.TypeAlias = '_MuxCodecH265ErrorException_NalTooLarge' + SpsParse: _typing.TypeAlias = '_MuxCodecH265ErrorException_SpsParse' + MissingLevelIdc: _typing.TypeAlias = '_MuxCodecH265ErrorException_MissingLevelIdc' + ForbiddenZeroBit: _typing.TypeAlias = '_MuxCodecH265ErrorException_ForbiddenZeroBit' + NotInitialized: _typing.TypeAlias = '_MuxCodecH265ErrorException_NotInitialized' + MissingSps: _typing.TypeAlias = '_MuxCodecH265ErrorException_MissingSps' + MissingTimestamp: _typing.TypeAlias = '_MuxCodecH265ErrorException_MissingTimestamp' + HvccTooShort: _typing.TypeAlias = '_MuxCodecH265ErrorException_HvccTooShort' + HvccTruncated: _typing.TypeAlias = '_MuxCodecH265ErrorException_HvccTruncated' + MissingParamSets: _typing.TypeAlias = '_MuxCodecH265ErrorException_MissingParamSets' + Annexb: _typing.TypeAlias = '_MuxCodecH265ErrorException_Annexb' + NoBaseLayerSps: _typing.TypeAlias = '_MuxCodecH265ErrorException_NoBaseLayerSps' +class _MuxCodecH265ErrorException_NalTooShort(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_NalTooLargeForHvcc(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_TooManyNals(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_NalTooLarge(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_SpsParse(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_MissingLevelIdc(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_ForbiddenZeroBit(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_NotInitialized(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_MissingSps(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_MissingTimestamp(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_HvccTooShort(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_HvccTruncated(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_MissingParamSets(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_Annexb(MuxCodecH265ErrorException): + ... +class _MuxCodecH265ErrorException_NoBaseLayerSps(MuxCodecH265ErrorException): + ... class MuxCodecH265ImportException(_Exception): def __init__(self, error: MuxCodecH265Import) -> None: ... def __str__(self) -> _str: ... class MuxCodecMp3ErrorException(_Exception): + def __new__(cls, error: MuxCodecMp3Error) -> _typing.Self: ... def __init__(self, error: MuxCodecMp3Error) -> None: ... def __str__(self) -> _str: ... + HeaderTooShort: _typing.TypeAlias = '_MuxCodecMp3ErrorException_HeaderTooShort' + MissingSync: _typing.TypeAlias = '_MuxCodecMp3ErrorException_MissingSync' + ReservedVersion: _typing.TypeAlias = '_MuxCodecMp3ErrorException_ReservedVersion' + NotLayer3: _typing.TypeAlias = '_MuxCodecMp3ErrorException_NotLayer3' + ReservedSampleRate: _typing.TypeAlias = '_MuxCodecMp3ErrorException_ReservedSampleRate' +class _MuxCodecMp3ErrorException_HeaderTooShort(MuxCodecMp3ErrorException): + ... +class _MuxCodecMp3ErrorException_MissingSync(MuxCodecMp3ErrorException): + ... +class _MuxCodecMp3ErrorException_ReservedVersion(MuxCodecMp3ErrorException): + ... +class _MuxCodecMp3ErrorException_NotLayer3(MuxCodecMp3ErrorException): + ... +class _MuxCodecMp3ErrorException_ReservedSampleRate(MuxCodecMp3ErrorException): + ... class MuxCodecMp3ImportException(_Exception): def __init__(self, error: MuxCodecMp3Import) -> None: ... def __str__(self) -> _str: ... class MuxCodecOpusErrorException(_Exception): + def __new__(cls, error: MuxCodecOpusError) -> _typing.Self: ... def __init__(self, error: MuxCodecOpusError) -> None: ... def __str__(self) -> _str: ... + HeadTooShort: _typing.TypeAlias = '_MuxCodecOpusErrorException_HeadTooShort' + InvalidSignature: _typing.TypeAlias = '_MuxCodecOpusErrorException_InvalidSignature' + UnsupportedVersion: _typing.TypeAlias = '_MuxCodecOpusErrorException_UnsupportedVersion' + UnsupportedChannelCount: _typing.TypeAlias = '_MuxCodecOpusErrorException_UnsupportedChannelCount' + MappingTableTooShort: _typing.TypeAlias = '_MuxCodecOpusErrorException_MappingTableTooShort' + InvalidMappingTable: _typing.TypeAlias = '_MuxCodecOpusErrorException_InvalidMappingTable' + UnsupportedMappingFamily: _typing.TypeAlias = '_MuxCodecOpusErrorException_UnsupportedMappingFamily' +class _MuxCodecOpusErrorException_HeadTooShort(MuxCodecOpusErrorException): + ... +class _MuxCodecOpusErrorException_InvalidSignature(MuxCodecOpusErrorException): + ... +class _MuxCodecOpusErrorException_UnsupportedVersion(MuxCodecOpusErrorException): + ... +class _MuxCodecOpusErrorException_UnsupportedChannelCount(MuxCodecOpusErrorException): + ... +class _MuxCodecOpusErrorException_MappingTableTooShort(MuxCodecOpusErrorException): + ... +class _MuxCodecOpusErrorException_InvalidMappingTable(MuxCodecOpusErrorException): + ... +class _MuxCodecOpusErrorException_UnsupportedMappingFamily(MuxCodecOpusErrorException): + ... class MuxCodecOpusImportException(_Exception): def __init__(self, error: MuxCodecOpusImport) -> None: ... def __str__(self) -> _str: ... @@ -7983,8 +8574,204 @@ class MuxCodecVp9ImportException(_Exception): def __init__(self, error: MuxCodecVp9Import) -> None: ... def __str__(self) -> _str: ... class MuxContainerFmp4ErrorException(_Exception): + def __new__(cls, error: MuxContainerFmp4Error) -> _typing.Self: ... def __init__(self, error: MuxContainerFmp4Error) -> None: ... def __str__(self) -> _str: ... + InvalidAspect: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_InvalidAspect' + InvalidSubtitle: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_InvalidSubtitle' + Mp4: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_Mp4' + Moq: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_Moq' + Flac: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_Flac' + Opus: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_Opus' + MissingKeyframe: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingKeyframe' + InvalidEnd: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_InvalidEnd' + TimestampRewind: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TimestampRewind' + TimestampOverflow: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TimestampOverflow' + NoTraf: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_NoTraf' + NoTfdt: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_NoTfdt' + PtsOverflow: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_PtsOverflow' + NoMoof: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_NoMoof' + NoMdat: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_NoMdat' + NoMoov: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_NoMoov' + NoTracks: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_NoTracks' + MultipleTracks: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MultipleTracks' + UnsupportedSynthesis: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnsupportedSynthesis' + UnsupportedSubtitle: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnsupportedSubtitle' + UnknownTrackHandler: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnknownTrackHandler' + MissingCodec: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingCodec' + MultipleCodecs: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MultipleCodecs' + UnknownCodec: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnknownCodec' + InvalidColr: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_InvalidColr' + UnsupportedSpatial: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnsupportedSpatial' + UnsupportedCodec: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnsupportedCodec' + UnsupportedMpeg2: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnsupportedMpeg2' + MissingDecoderSpecific: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingDecoderSpecific' + DuplicateMoof: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_DuplicateMoof' + DuplicateMoov: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_DuplicateMoov' + MissingTrun: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingTrun' + MissingTfdt: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingTfdt' + MissingVideoDescription: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingVideoDescription' + MissingVideoDimensions: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingVideoDimensions' + InvalidDataOffset: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_InvalidDataOffset' + BackwardsDataOffset: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_BackwardsDataOffset' + MetadataTooLarge: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MetadataTooLarge' + TextSampleTooLarge: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TextSampleTooLarge' + TooManySamples: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TooManySamples' + TooManyTracks: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TooManyTracks' + UnsupportedBaseDataOffset: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnsupportedBaseDataOffset' + EmptySample: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_EmptySample' + TimescaleMismatch: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TimescaleMismatch' + UnknownTrack: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnknownTrack' + NoKeyframe: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_NoKeyframe' + SampleRangeOutOfBounds: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_SampleRangeOutOfBounds' + NoFrames: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_NoFrames' + MissingAudioDescription: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingAudioDescription' + OpusChannelCount: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_OpusChannelCount' + MissingSampleDuration: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingSampleDuration' + TimescaleTooLarge: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TimescaleTooLarge' + TimescaleOverride: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TimescaleOverride' + SampleDurationTooLarge: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_SampleDurationTooLarge' + SampleDurationTooSmall: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_SampleDurationTooSmall' + SampleDurationInexact: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_SampleDurationInexact' + MissingVideoDuration: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_MissingVideoDuration' + NonMonotonicDecodeTime: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_NonMonotonicDecodeTime' + TrackAdded: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TrackAdded' + TrackChanged: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TrackChanged' + TrackRewound: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TrackRewound' + TrackUndescribed: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_TrackUndescribed' + UnsupportedEditList: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_UnsupportedEditList' + Unindexable: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_Unindexable' + Unrepairable: _typing.TypeAlias = '_MuxContainerFmp4ErrorException_Unrepairable' +class _MuxContainerFmp4ErrorException_InvalidAspect(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_InvalidSubtitle(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_Mp4(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_Moq(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_Flac(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_Opus(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingKeyframe(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_InvalidEnd(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TimestampRewind(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TimestampOverflow(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_NoTraf(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_NoTfdt(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_PtsOverflow(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_NoMoof(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_NoMdat(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_NoMoov(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_NoTracks(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MultipleTracks(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnsupportedSynthesis(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnsupportedSubtitle(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnknownTrackHandler(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingCodec(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MultipleCodecs(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnknownCodec(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_InvalidColr(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnsupportedSpatial(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnsupportedCodec(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnsupportedMpeg2(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingDecoderSpecific(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_DuplicateMoof(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_DuplicateMoov(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingTrun(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingTfdt(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingVideoDescription(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingVideoDimensions(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_InvalidDataOffset(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_BackwardsDataOffset(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MetadataTooLarge(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TextSampleTooLarge(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TooManySamples(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TooManyTracks(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnsupportedBaseDataOffset(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_EmptySample(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TimescaleMismatch(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnknownTrack(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_NoKeyframe(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_SampleRangeOutOfBounds(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_NoFrames(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingAudioDescription(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_OpusChannelCount(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingSampleDuration(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TimescaleTooLarge(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TimescaleOverride(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_SampleDurationTooLarge(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_SampleDurationTooSmall(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_SampleDurationInexact(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_MissingVideoDuration(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_NonMonotonicDecodeTime(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TrackAdded(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TrackChanged(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TrackRewound(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_TrackUndescribed(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_UnsupportedEditList(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_Unindexable(MuxContainerFmp4ErrorException): + ... +class _MuxContainerFmp4ErrorException_Unrepairable(MuxContainerFmp4ErrorException): + ... class MuxContainerProducerContainerAudioConfigException(_Exception): def __init__(self, error: MuxContainerProducerContainerAudioConfig) -> None: ... def __str__(self) -> _str: ... @@ -8058,11 +8845,196 @@ class MuxContainerProducerLocWireVideoConfigException(_Exception): def __init__(self, error: MuxContainerProducerLocWireVideoConfig) -> None: ... def __str__(self) -> _str: ... class MuxContainerTsErrorException(_Exception): + def __new__(cls, error: MuxContainerTsError) -> _typing.Self: ... def __init__(self, error: MuxContainerTsError) -> None: ... def __str__(self) -> _str: ... + MultiplePrograms: _typing.TypeAlias = '_MuxContainerTsErrorException_MultiplePrograms' + MissingProgram: _typing.TypeAlias = '_MuxContainerTsErrorException_MissingProgram' + Restarted: _typing.TypeAlias = '_MuxContainerTsErrorException_Restarted' + Empty: _typing.TypeAlias = '_MuxContainerTsErrorException_Empty' + Malformed: _typing.TypeAlias = '_MuxContainerTsErrorException_Malformed' + Unsupported: _typing.TypeAlias = '_MuxContainerTsErrorException_Unsupported' + Mux: _typing.TypeAlias = '_MuxContainerTsErrorException_Mux' +class _MuxContainerTsErrorException_MultiplePrograms(MuxContainerTsErrorException): + ... +class _MuxContainerTsErrorException_MissingProgram(MuxContainerTsErrorException): + ... +class _MuxContainerTsErrorException_Restarted(MuxContainerTsErrorException): + ... +class _MuxContainerTsErrorException_Empty(MuxContainerTsErrorException): + ... +class _MuxContainerTsErrorException_Malformed(MuxContainerTsErrorException): + ... +class _MuxContainerTsErrorException_Unsupported(MuxContainerTsErrorException): + ... +class _MuxContainerTsErrorException_Mux(MuxContainerTsErrorException): + ... class MuxErrorException(_Exception): + def __new__(cls, error: MuxError) -> _typing.Self: ... def __init__(self, error: MuxError) -> None: ... def __str__(self) -> _str: ... + Moq: _typing.TypeAlias = '_MuxErrorException_Moq' + Hang: _typing.TypeAlias = '_MuxErrorException_Hang' + Json: _typing.TypeAlias = '_MuxErrorException_Json' + UnsupportedMode: _typing.TypeAlias = '_MuxErrorException_UnsupportedMode' + ForeignBroadcast: _typing.TypeAlias = '_MuxErrorException_ForeignBroadcast' + Cmaf: _typing.TypeAlias = '_MuxErrorException_Cmaf' + Ts: _typing.TypeAlias = '_MuxErrorException_Ts' + Mkv: _typing.TypeAlias = '_MuxErrorException_Mkv' + Flv: _typing.TypeAlias = '_MuxErrorException_Flv' + Msf: _typing.TypeAlias = '_MuxErrorException_Msf' + Loc: _typing.TypeAlias = '_MuxErrorException_Loc' + Annexb: _typing.TypeAlias = '_MuxErrorException_Annexb' + Aac: _typing.TypeAlias = '_MuxErrorException_Aac' + Opus: _typing.TypeAlias = '_MuxErrorException_Opus' + Flac: _typing.TypeAlias = '_MuxErrorException_Flac' + Mp3: _typing.TypeAlias = '_MuxErrorException_Mp3' + H264: _typing.TypeAlias = '_MuxErrorException_H264' + H265: _typing.TypeAlias = '_MuxErrorException_H265' + Av1: _typing.TypeAlias = '_MuxErrorException_Av1' + Vp8: _typing.TypeAlias = '_MuxErrorException_Vp8' + Vp9: _typing.TypeAlias = '_MuxErrorException_Vp9' + Legacy: _typing.TypeAlias = '_MuxErrorException_Legacy' + TimestampOverflow: _typing.TypeAlias = '_MuxErrorException_TimestampOverflow' + Mp4: _typing.TypeAlias = '_MuxErrorException_Mp4' + Io: _typing.TypeAlias = '_MuxErrorException_Io' + Url: _typing.TypeAlias = '_MuxErrorException_Url' + UnknownFormat: _typing.TypeAlias = '_MuxErrorException_UnknownFormat' + NotSelfDescribing: _typing.TypeAlias = '_MuxErrorException_NotSelfDescribing' + WrongKind: _typing.TypeAlias = '_MuxErrorException_WrongKind' + Reorder: _typing.TypeAlias = '_MuxErrorException_Reorder' + Drift: _typing.TypeAlias = '_MuxErrorException_Drift' + Retired: _typing.TypeAlias = '_MuxErrorException_Retired' + MissingKeyframe: _typing.TypeAlias = '_MuxErrorException_MissingKeyframe' + InvalidEnd: _typing.TypeAlias = '_MuxErrorException_InvalidEnd' + TimestampRewind: _typing.TypeAlias = '_MuxErrorException_TimestampRewind' + NotPublished: _typing.TypeAlias = '_MuxErrorException_NotPublished' + NegativeFlvPts: _typing.TypeAlias = '_MuxErrorException_NegativeFlvPts' + UnmappableTimestamp: _typing.TypeAlias = '_MuxErrorException_UnmappableTimestamp' + ReservedSection: _typing.TypeAlias = '_MuxErrorException_ReservedSection' + UnsupportedContainer: _typing.TypeAlias = '_MuxErrorException_UnsupportedContainer' + EscapingBroadcast: _typing.TypeAlias = '_MuxErrorException_EscapingBroadcast' + InstanceMismatch: _typing.TypeAlias = '_MuxErrorException_InstanceMismatch' + JitterDecreased: _typing.TypeAlias = '_MuxErrorException_JitterDecreased' + DelayDecreased: _typing.TypeAlias = '_MuxErrorException_DelayDecreased' + InvalidCapture: _typing.TypeAlias = '_MuxErrorException_InvalidCapture' + NoMpegtsSection: _typing.TypeAlias = '_MuxErrorException_NoMpegtsSection' + TsPacketSize: _typing.TypeAlias = '_MuxErrorException_TsPacketSize' + PcrRewind: _typing.TypeAlias = '_MuxErrorException_PcrRewind' + PcrRestart: _typing.TypeAlias = '_MuxErrorException_PcrRestart' + PcrGap: _typing.TypeAlias = '_MuxErrorException_PcrGap' + Replaced: _typing.TypeAlias = '_MuxErrorException_Replaced' + IdentityChanged: _typing.TypeAlias = '_MuxErrorException_IdentityChanged' + RenditionRewound: _typing.TypeAlias = '_MuxErrorException_RenditionRewound' + Finished: _typing.TypeAlias = '_MuxErrorException_Finished' +class _MuxErrorException_Moq(MuxErrorException): + ... +class _MuxErrorException_Hang(MuxErrorException): + ... +class _MuxErrorException_Json(MuxErrorException): + ... +class _MuxErrorException_UnsupportedMode(MuxErrorException): + ... +class _MuxErrorException_ForeignBroadcast(MuxErrorException): + ... +class _MuxErrorException_Cmaf(MuxErrorException): + ... +class _MuxErrorException_Ts(MuxErrorException): + ... +class _MuxErrorException_Mkv(MuxErrorException): + ... +class _MuxErrorException_Flv(MuxErrorException): + ... +class _MuxErrorException_Msf(MuxErrorException): + ... +class _MuxErrorException_Loc(MuxErrorException): + ... +class _MuxErrorException_Annexb(MuxErrorException): + ... +class _MuxErrorException_Aac(MuxErrorException): + ... +class _MuxErrorException_Opus(MuxErrorException): + ... +class _MuxErrorException_Flac(MuxErrorException): + ... +class _MuxErrorException_Mp3(MuxErrorException): + ... +class _MuxErrorException_H264(MuxErrorException): + ... +class _MuxErrorException_H265(MuxErrorException): + ... +class _MuxErrorException_Av1(MuxErrorException): + ... +class _MuxErrorException_Vp8(MuxErrorException): + ... +class _MuxErrorException_Vp9(MuxErrorException): + ... +class _MuxErrorException_Legacy(MuxErrorException): + ... +class _MuxErrorException_TimestampOverflow(MuxErrorException): + ... +class _MuxErrorException_Mp4(MuxErrorException): + ... +class _MuxErrorException_Io(MuxErrorException): + ... +class _MuxErrorException_Url(MuxErrorException): + ... +class _MuxErrorException_UnknownFormat(MuxErrorException): + ... +class _MuxErrorException_NotSelfDescribing(MuxErrorException): + ... +class _MuxErrorException_WrongKind(MuxErrorException): + ... +class _MuxErrorException_Reorder(MuxErrorException): + ... +class _MuxErrorException_Drift(MuxErrorException): + ... +class _MuxErrorException_Retired(MuxErrorException): + ... +class _MuxErrorException_MissingKeyframe(MuxErrorException): + ... +class _MuxErrorException_InvalidEnd(MuxErrorException): + ... +class _MuxErrorException_TimestampRewind(MuxErrorException): + ... +class _MuxErrorException_NotPublished(MuxErrorException): + ... +class _MuxErrorException_NegativeFlvPts(MuxErrorException): + ... +class _MuxErrorException_UnmappableTimestamp(MuxErrorException): + ... +class _MuxErrorException_ReservedSection(MuxErrorException): + ... +class _MuxErrorException_UnsupportedContainer(MuxErrorException): + ... +class _MuxErrorException_EscapingBroadcast(MuxErrorException): + ... +class _MuxErrorException_InstanceMismatch(MuxErrorException): + ... +class _MuxErrorException_JitterDecreased(MuxErrorException): + ... +class _MuxErrorException_DelayDecreased(MuxErrorException): + ... +class _MuxErrorException_InvalidCapture(MuxErrorException): + ... +class _MuxErrorException_NoMpegtsSection(MuxErrorException): + ... +class _MuxErrorException_TsPacketSize(MuxErrorException): + ... +class _MuxErrorException_PcrRewind(MuxErrorException): + ... +class _MuxErrorException_PcrRestart(MuxErrorException): + ... +class _MuxErrorException_PcrGap(MuxErrorException): + ... +class _MuxErrorException_Replaced(MuxErrorException): + ... +class _MuxErrorException_IdentityChanged(MuxErrorException): + ... +class _MuxErrorException_RenditionRewound(MuxErrorException): + ... +class _MuxErrorException_Finished(MuxErrorException): + ... class MuxImportTrackException(_Exception): def __init__(self, error: MuxImportTrack) -> None: ... def __str__(self) -> _str: ... @@ -8076,8 +9048,18 @@ class MuxJsonStreamJsonException(_Exception): def __init__(self, error: MuxJsonStreamJson) -> None: ... def __str__(self) -> _str: ... class PathErrorException(_Exception): + def __new__(cls, error: PathError) -> _typing.Self: ... def __init__(self, error: PathError) -> None: ... def __str__(self) -> _str: ... + TooLong: _typing.TypeAlias = '_PathErrorException_TooLong' + EmptySegment: _typing.TypeAlias = '_PathErrorException_EmptySegment' + InvalidEscape: _typing.TypeAlias = '_PathErrorException_InvalidEscape' +class _PathErrorException_TooLong(PathErrorException): + ... +class _PathErrorException_EmptySegment(PathErrorException): + ... +class _PathErrorException_InvalidEscape(PathErrorException): + ... class StringException(_Exception): def __init__(self, error: _str) -> None: ... def __str__(self) -> _str: ... @@ -8085,11 +9067,214 @@ class TimeOverflowException(_Exception): def __init__(self, error: TimeOverflow) -> None: ... def __str__(self) -> _str: ... class TokioErrorException(_Exception): + def __new__(cls, error: TokioError) -> _typing.Self: ... def __init__(self, error: TokioError) -> None: ... def __str__(self) -> _str: ... + PinnedRedirect: _typing.TypeAlias = '_TokioErrorException_PinnedRedirect' + RefusedRedirect: _typing.TypeAlias = '_TokioErrorException_RefusedRedirect' + Io: _typing.TypeAlias = '_TokioErrorException_Io' + MoqNet: _typing.TypeAlias = '_TokioErrorException_MoqNet' + Directive: _typing.TypeAlias = '_TokioErrorException_Directive' + SetSubscriber: _typing.TypeAlias = '_TokioErrorException_SetSubscriber' + Logcat: _typing.TypeAlias = '_TokioErrorException_Logcat' + NoBackend: _typing.TypeAlias = '_TokioErrorException_NoBackend' + KeylogUnset: _typing.TypeAlias = '_TokioErrorException_KeylogUnset' + BackoffHealthy: _typing.TypeAlias = '_TokioErrorException_BackoffHealthy' + Deprecated: _typing.TypeAlias = '_TokioErrorException_Deprecated' + IdleTimeoutRange: _typing.TypeAlias = '_TokioErrorException_IdleTimeoutRange' + WindowRange: _typing.TypeAlias = '_TokioErrorException_WindowRange' + StreamsRange: _typing.TypeAlias = '_TokioErrorException_StreamsRange' + ReceiveWindowTooSmall: _typing.TypeAlias = '_TokioErrorException_ReceiveWindowTooSmall' + ConnectFailed: _typing.TypeAlias = '_TokioErrorException_ConnectFailed' + ConnectTimeout: _typing.TypeAlias = '_TokioErrorException_ConnectTimeout' + ClientCertScheme: _typing.TypeAlias = '_TokioErrorException_ClientCertScheme' + Connect: _typing.TypeAlias = '_TokioErrorException_Connect' + TransportRace: _typing.TypeAlias = '_TokioErrorException_TransportRace' + MtlsUnsupported: _typing.TypeAlias = '_TokioErrorException_MtlsUnsupported' + WorkerCount: _typing.TypeAlias = '_TokioErrorException_WorkerCount' + WorkerOverlap: _typing.TypeAlias = '_TokioErrorException_WorkerOverlap' + WorkerResolve: _typing.TypeAlias = '_TokioErrorException_WorkerResolve' + WorkerStart: _typing.TypeAlias = '_TokioErrorException_WorkerStart' + InvalidStatusCode: _typing.TypeAlias = '_TokioErrorException_InvalidStatusCode' + Reconnect: _typing.TypeAlias = '_TokioErrorException_Reconnect' + Stopped: _typing.TypeAlias = '_TokioErrorException_Stopped' + Panic: _typing.TypeAlias = '_TokioErrorException_Panic' + Accept: _typing.TypeAlias = '_TokioErrorException_Accept' + Tls: _typing.TypeAlias = '_TokioErrorException_Tls' + Quic: _typing.TypeAlias = '_TokioErrorException_Quic' + WebSocket: _typing.TypeAlias = '_TokioErrorException_WebSocket' + Tcp: _typing.TypeAlias = '_TokioErrorException_Tcp' + Unix: _typing.TypeAlias = '_TokioErrorException_Unix' + Watch: _typing.TypeAlias = '_TokioErrorException_Watch' + QmuxLimits: _typing.TypeAlias = '_TokioErrorException_QmuxLimits' +class _TokioErrorException_PinnedRedirect(TokioErrorException): + ... +class _TokioErrorException_RefusedRedirect(TokioErrorException): + ... +class _TokioErrorException_Io(TokioErrorException): + ... +class _TokioErrorException_MoqNet(TokioErrorException): + ... +class _TokioErrorException_Directive(TokioErrorException): + ... +class _TokioErrorException_SetSubscriber(TokioErrorException): + ... +class _TokioErrorException_Logcat(TokioErrorException): + ... +class _TokioErrorException_NoBackend(TokioErrorException): + ... +class _TokioErrorException_KeylogUnset(TokioErrorException): + ... +class _TokioErrorException_BackoffHealthy(TokioErrorException): + ... +class _TokioErrorException_Deprecated(TokioErrorException): + ... +class _TokioErrorException_IdleTimeoutRange(TokioErrorException): + ... +class _TokioErrorException_WindowRange(TokioErrorException): + ... +class _TokioErrorException_StreamsRange(TokioErrorException): + ... +class _TokioErrorException_ReceiveWindowTooSmall(TokioErrorException): + ... +class _TokioErrorException_ConnectFailed(TokioErrorException): + ... +class _TokioErrorException_ConnectTimeout(TokioErrorException): + ... +class _TokioErrorException_ClientCertScheme(TokioErrorException): + ... +class _TokioErrorException_Connect(TokioErrorException): + ... +class _TokioErrorException_TransportRace(TokioErrorException): + ... +class _TokioErrorException_MtlsUnsupported(TokioErrorException): + ... +class _TokioErrorException_WorkerCount(TokioErrorException): + ... +class _TokioErrorException_WorkerOverlap(TokioErrorException): + ... +class _TokioErrorException_WorkerResolve(TokioErrorException): + ... +class _TokioErrorException_WorkerStart(TokioErrorException): + ... +class _TokioErrorException_InvalidStatusCode(TokioErrorException): + ... +class _TokioErrorException_Reconnect(TokioErrorException): + ... +class _TokioErrorException_Stopped(TokioErrorException): + ... +class _TokioErrorException_Panic(TokioErrorException): + ... +class _TokioErrorException_Accept(TokioErrorException): + ... +class _TokioErrorException_Tls(TokioErrorException): + ... +class _TokioErrorException_Quic(TokioErrorException): + ... +class _TokioErrorException_WebSocket(TokioErrorException): + ... +class _TokioErrorException_Tcp(TokioErrorException): + ... +class _TokioErrorException_Unix(TokioErrorException): + ... +class _TokioErrorException_Watch(TokioErrorException): + ... +class _TokioErrorException_QmuxLimits(TokioErrorException): + ... class TokioTlsErrorException(_Exception): + def __new__(cls, error: TokioTlsError) -> _typing.Self: ... def __init__(self, error: TokioTlsError) -> None: ... def __str__(self) -> _str: ... + Watch: _typing.TypeAlias = '_TokioTlsErrorException_Watch' + ConflictingServe: _typing.TypeAlias = '_TokioTlsErrorException_ConflictingServe' + Open: _typing.TypeAlias = '_TokioTlsErrorException_Open' + ReadFile: _typing.TypeAlias = '_TokioTlsErrorException_ReadFile' + Read: _typing.TypeAlias = '_TokioTlsErrorException_Read' + Key: _typing.TypeAlias = '_TokioTlsErrorException_Key' + LoadKey: _typing.TypeAlias = '_TokioTlsErrorException_LoadKey' + Empty: _typing.TypeAlias = '_TokioTlsErrorException_Empty' + EmptyRoots: _typing.TypeAlias = '_TokioTlsErrorException_EmptyRoots' + NoRoots: _typing.TypeAlias = '_TokioTlsErrorException_NoRoots' + Fingerprint: _typing.TypeAlias = '_TokioTlsErrorException_Fingerprint' + FingerprintLength: _typing.TypeAlias = '_TokioTlsErrorException_FingerprintLength' + FingerprintWithRoots: _typing.TypeAlias = '_TokioTlsErrorException_FingerprintWithRoots' + ConflictingClientAuth: _typing.TypeAlias = '_TokioTlsErrorException_ConflictingClientAuth' + DisableVerifyWithTrust: _typing.TypeAlias = '_TokioTlsErrorException_DisableVerifyWithTrust' + InvalidHostName: _typing.TypeAlias = '_TokioTlsErrorException_InvalidHostName' + AddRoot: _typing.TypeAlias = '_TokioTlsErrorException_AddRoot' + IncompleteClientAuth: _typing.TypeAlias = '_TokioTlsErrorException_IncompleteClientAuth' + CertKeyCountMismatch: _typing.TypeAlias = '_TokioTlsErrorException_CertKeyCountMismatch' + NoCertSource: _typing.TypeAlias = '_TokioTlsErrorException_NoCertSource' + ConflictingResolver: _typing.TypeAlias = '_TokioTlsErrorException_ConflictingResolver' + KeyMismatch: _typing.TypeAlias = '_TokioTlsErrorException_KeyMismatch' + KeyLog: _typing.TypeAlias = '_TokioTlsErrorException_KeyLog' + Rustls: _typing.TypeAlias = '_TokioTlsErrorException_Rustls' + ClientVerifier: _typing.TypeAlias = '_TokioTlsErrorException_ClientVerifier' + ServerVerifier: _typing.TypeAlias = '_TokioTlsErrorException_ServerVerifier' + Rcgen: _typing.TypeAlias = '_TokioTlsErrorException_Rcgen' + Lineage: _typing.TypeAlias = '_TokioTlsErrorException_Lineage' + UnsupportedCpu: _typing.TypeAlias = '_TokioTlsErrorException_UnsupportedCpu' + Deprecated: _typing.TypeAlias = '_TokioTlsErrorException_Deprecated' +class _TokioTlsErrorException_Watch(TokioTlsErrorException): + ... +class _TokioTlsErrorException_ConflictingServe(TokioTlsErrorException): + ... +class _TokioTlsErrorException_Open(TokioTlsErrorException): + ... +class _TokioTlsErrorException_ReadFile(TokioTlsErrorException): + ... +class _TokioTlsErrorException_Read(TokioTlsErrorException): + ... +class _TokioTlsErrorException_Key(TokioTlsErrorException): + ... +class _TokioTlsErrorException_LoadKey(TokioTlsErrorException): + ... +class _TokioTlsErrorException_Empty(TokioTlsErrorException): + ... +class _TokioTlsErrorException_EmptyRoots(TokioTlsErrorException): + ... +class _TokioTlsErrorException_NoRoots(TokioTlsErrorException): + ... +class _TokioTlsErrorException_Fingerprint(TokioTlsErrorException): + ... +class _TokioTlsErrorException_FingerprintLength(TokioTlsErrorException): + ... +class _TokioTlsErrorException_FingerprintWithRoots(TokioTlsErrorException): + ... +class _TokioTlsErrorException_ConflictingClientAuth(TokioTlsErrorException): + ... +class _TokioTlsErrorException_DisableVerifyWithTrust(TokioTlsErrorException): + ... +class _TokioTlsErrorException_InvalidHostName(TokioTlsErrorException): + ... +class _TokioTlsErrorException_AddRoot(TokioTlsErrorException): + ... +class _TokioTlsErrorException_IncompleteClientAuth(TokioTlsErrorException): + ... +class _TokioTlsErrorException_CertKeyCountMismatch(TokioTlsErrorException): + ... +class _TokioTlsErrorException_NoCertSource(TokioTlsErrorException): + ... +class _TokioTlsErrorException_ConflictingResolver(TokioTlsErrorException): + ... +class _TokioTlsErrorException_KeyMismatch(TokioTlsErrorException): + ... +class _TokioTlsErrorException_KeyLog(TokioTlsErrorException): + ... +class _TokioTlsErrorException_Rustls(TokioTlsErrorException): + ... +class _TokioTlsErrorException_ClientVerifier(TokioTlsErrorException): + ... +class _TokioTlsErrorException_ServerVerifier(TokioTlsErrorException): + ... +class _TokioTlsErrorException_Rcgen(TokioTlsErrorException): + ... +class _TokioTlsErrorException_Lineage(TokioTlsErrorException): + ... +class _TokioTlsErrorException_UnsupportedCpu(TokioTlsErrorException): + ... +class _TokioTlsErrorException_Deprecated(TokioTlsErrorException): + ... class TrackProducerException(_Exception): def __init__(self, error: TrackProducer) -> None: ... def __str__(self) -> _str: ... diff --git a/ffi/tests/api.py b/ffi/tests/api.py index c600d0e84..716e201cc 100644 --- a/ffi/tests/api.py +++ b/ffi/tests/api.py @@ -3,11 +3,13 @@ # functions here that transcript.rs defines. tests/fixtures.rs compares the transcripts. # # With an argument, it instead checks the futures' semantics, what frees what nobody -# closed, the values only Python's types bound, or how Python calls into the extension, -# or breaks a contract, which must fail. +# closed, the values only Python's types bound, how Python calls into the extension, or +# what Python code expects of a package, or breaks a contract, which must fail. import array import asyncio +import copy +import dataclasses import datetime import gc import io @@ -1131,6 +1133,111 @@ def raises(f, message): print("calls ok") +def idioms(): + """What Python code expects of a package: an error's exception per variant, weak + references to objects and records, records `dataclasses` takes as its own, and an await + off asyncio's loop refused with a message naming asyncio.""" + + def raised(f): + try: + f() + except Exception as e: + return e + check(False, f"{f} raises") + + # An enum's variants, each raised as its own subclass of the error's exception. + c = api.Counter.new("c", 5) + e = raised(lambda: c.add(2000)) + check(type(e) is api.ErrorException.Overflow, repr(type(e))) + check(isinstance(e, api.ErrorException) and e.error == api.Error.Overflow(), "an overflow is the error's") + check(type(e).__qualname__ == "ErrorException.Overflow", type(e).__qualname__) + e = raised(lambda: c.sub(20)) + check(type(e) is api.ErrorException.Underflow and e.error == api.Error.Underflow(by=15), repr(e)) + check(not isinstance(e, api.ErrorException.Overflow), "an underflow is no overflow") + try: + api.divide(7, 0) + check(False, "a division by zero raises") + except api.ErrorException.Underflow: + check(False, "a division by zero is no underflow") + except api.ErrorException.Overflow: + pass + # Python makes the same subclass of a variant, as a closure raising it to Rust does. + check(type(api.ErrorException(api.Error.Overflow())) is api.ErrorException.Overflow, "made by its variant") + check(type(api.ErrorException.Underflow(api.Error.Underflow(by=1))) is api.ErrorException.Underflow, "made as itself") + + # An object that is an enum, whose fields no binding reads, raises by its variant too. + for n, variant, text in [ + (0, api.FaultException.Busy, "busy"), + (1, api.FaultException.Lost, "lost frame"), + (2, api.FaultException.Late, "late by 7"), + ]: + e = raised(lambda: api.jam(n)) + check(type(e) is variant and str(e) == text, f"{n}: {e!r} {e}") + check(type(api.FaultException(e.error)) is variant, f"{n}: made by its variant") + check(api.jam(3) == 3, "no fault") + + # Weak references to an object, an opaque value, a record, a variant, and a range's bound. + for make in [ + lambda: api.Counter.new("w", 1), + lambda: api.Stamp.from_millis(5), + lambda: api.Point(1, 2), + lambda: api.Error.Underflow(by=1), + lambda: api.BoundU64(api.Bound.INCLUDED, 3), + ]: + value = make() + gone = [] + ref = weakref.ref(value, gone.append) + check(ref() is value, f"{value!r} is weakly referenced") + del value + check(ref() is None and gone == [ref], "a weak reference dies with its referent") + + # A record is a dataclass to `dataclasses`, `copy`, and `match`, as `@dataclass` made it. + # A subclass's fields are its record's, read first through either, and a dataclass may + # subclass a record. + class Hidden(api.Point): + __match_args__ = () + + check(dataclasses.asdict(Hidden(1, 2)) == {"x": 1, "y": 2}, "a subclass's own __match_args__") + + class Sub(api.Point): + pass + + check(dataclasses.asdict(Sub(1, 2)) == {"x": 1, "y": 2}, "a subclass's fields") + + @dataclasses.dataclass + class Tagged(api.Weighted): + tag: str = "" + + tagged = Tagged(api.Score.of(1), 2, "t") + check([f.name for f in dataclasses.fields(tagged)] == ["score", "weight", "tag"], "a dataclass subclass") + weighted = api.Weighted(tagged.score, 2) + check(weighted == api.Weighted(tagged.score, 2) and weighted != tagged and tagged != weighted, "== only its own class") + p = api.Point(1, 2) + check(dataclasses.is_dataclass(p) and [f.name for f in dataclasses.fields(api.Point)] == ["x", "y"], "fields") + check(dataclasses.replace(p, x=5) == api.Point(5, 2) and p == api.Point(1, 2), "replace") + check(dataclasses.asdict(api.Platform.Native(64)) == {"_0": 64}, "asdict") + if sys.version_info >= (3, 13): + check(copy.replace(p, y=7) == api.Point(1, 7), "copy.replace") + check(copy.copy(p) == p and copy.copy(p) is not p, "copy") + match api.Platform.Native(64): + case api.Platform.Native(bits): + check(bits == 64, "matched positionally") + case _: + check(False, "a variant matches its class") + check(repr(api.Platform.Native(64)) == "Platform.Native(_0=64)", repr(api.Platform.Native(64))) + check(p != api.Point(1, 3) and p != (1, 2) and api.Point.__eq__(p, (1, 2)) is NotImplemented, "eq") + check(api.Platform.Native(64) != api.Platform.Wasm(64), "variants differ") + check(api.Point.__hash__ is None, "a record is unhashable, as Rust's without Hash") + + # An await or a waker off a running asyncio loop names asyncio. + coro = api.Local.default().later() + e = raised(lambda: coro.send(None)) + check(type(e) is RuntimeError and "asyncio" in str(e) and "trio" in str(e), str(e)) + e = raised(lambda: api.Waker(lambda: None)) + check(type(e) is RuntimeError and "asyncio" in str(e), str(e)) + print("idioms ok") + + def leaf(): """Calls proven to reach no user code keep the GIL; one that only looks like them releases it, which a hook Rust calls from another thread, which takes the GIL, proves: @@ -1286,5 +1393,7 @@ def readinto(self, buffer, /): checks() case ["leaf"]: leaf() + case ["idioms"]: + idioms() case [which]: broken(which) diff --git a/ffi/tests/api_types.py b/ffi/tests/api_types.py index 05fc18602..c14b807dc 100644 --- a/ffi/tests/api_types.py +++ b/ffi/tests/api_types.py @@ -4,6 +4,7 @@ import array import asyncio +import dataclasses import io import api @@ -54,3 +55,14 @@ def drive(now: api.Moment, waiter: api.Waiter) -> api.Moment | None: made: str = api.made(3, lambda n: f"{n} times") spawned: int = api.Spawned.new(lambda: 7).join() polled: None = asyncio.run(api.Waiter.poll_future(asyncio.sleep(0))) + +# An error's variant is its own subclass, and a record a dataclass to `dataclasses`. +try: + api.jam(0) +except api.FaultException.Busy as busy: + fault: api.Fault = busy.error +except api.ErrorException.Overflow as overflow: + error: api.Error = overflow.error +over: api.ErrorException.Overflow = api.ErrorException.Overflow(api.Error.Overflow()) +moved: api.Point = dataclasses.replace(api.Point(1, 2), x=3) +named: tuple[str, ...] = tuple(f.name for f in dataclasses.fields(moved)) diff --git a/ffi/tests/bare_builtins.py b/ffi/tests/bare_builtins.py index 346d209be..747fa657f 100644 --- a/ffi/tests/bare_builtins.py +++ b/ffi/tests/bare_builtins.py @@ -2,7 +2,8 @@ Run as `python3 -I bare_builtins.py api.py`. A method or function named as a builtin, such as `bytes`, shadows that builtin in the class or module that declares it, so the module -reads each builtin through an import alias such as `_bytes` instead. +reads each builtin through an import alias such as `_bytes` instead. A parameter named as +one, such as a record's `__init__` taking its field `len`, is that parameter in its body. """ import ast @@ -11,10 +12,31 @@ allowed = {"__name__"} tree = ast.parse(open(sys.argv[1]).read()) + + +def loads(node, params): + """Each name `node` reads, but the parameters of a function whose body it is in.""" + if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.Lambda)): + a = node.args + inner = params | {p.arg for p in a.posonlyargs + a.args + a.kwonlyargs + [a.vararg, a.kwarg] if p} + # Decorators, defaults, and annotations read the enclosing scope's names. + body = node.body if isinstance(node.body, list) else [node.body] + for child in ast.iter_child_nodes(node): + yield from loads(child, inner if any(child is b for b in body) else params) + return + if isinstance(node, ast.Name) and isinstance(node.ctx, ast.Load) and node.id not in params: + yield node + for child in ast.iter_child_nodes(node): + yield from loads(child, params) + + +# A default is read in the enclosing scope, and the body reads the parameter. +assert [n.lineno for n in loads(ast.parse("def f(len=len):\n\tlen"), frozenset()) if n.id == "len"] == [1] + bare = sorted( f"{sys.argv[1]}:{n.lineno}: {n.id}" - for n in ast.walk(tree) - if isinstance(n, ast.Name) and isinstance(n.ctx, ast.Load) and hasattr(builtins, n.id) and n.id not in allowed + for n in loads(tree, frozenset()) + if hasattr(builtins, n.id) and n.id not in allowed ) if bare: sys.exit("a builtin read by its bare name:\n" + "\n".join(bare)) diff --git a/ffi/tests/fixtures.rs b/ffi/tests/fixtures.rs index 39b25cdd6..dd946017d 100644 --- a/ffi/tests/fixtures.rs +++ b/ffi/tests/fixtures.rs @@ -1412,7 +1412,7 @@ fn api_python() { api.transcript, "the Python transcript differs from the native one" ); - for case in ["futures", "owned", "values", "calls", "checks", "leaf"] { + for case in ["futures", "owned", "values", "calls", "checks", "leaf", "idioms"] { run(&mut python(&dir, &[case])); } for (case, message) in [ diff --git a/quest/m1/ffi-export/README.md b/quest/m1/ffi-export/README.md index e4575157f..fc718f74f 100644 --- a/quest/m1/ffi-export/README.md +++ b/quest/m1/ffi-export/README.md @@ -98,7 +98,7 @@ Decided with the maintainer on 2026-11-18, in the per-language audit: as soon as possible: "You're allowed to break the API absolutely. Do it sooner." They are the API surface lock (`ffi/surface/`), which landed first, [C and C++](/quest/m1/ffi-export/cpp-idioms.md), [Swift](/quest/m1/ffi-export/swift-span.md), - Kotlin (landed), [Python](/quest/m1/ffi-export/python-idioms.md), + Kotlin (landed), Python (landed), [Dart](/quest/m1/ffi-export/dart-analyze.md), and [docs](/quest/m1/ffi-export/docs.md). Rejected: only the surface lock holding the pin; all of them after the pin. - ✅ Work that changes no generated API, or only adds to it, stays out of this epic, as diff --git a/quest/m1/ffi-export/python-idioms.md b/quest/m1/ffi-export/python-idioms.md deleted file mode 100644 index 4bf0ba315..000000000 --- a/quest/m1/ffi-export/python-idioms.md +++ /dev/null @@ -1,26 +0,0 @@ -# [M] Python: an exception hierarchy, weak references, and a faster import - -## Goal - -- Each exported error is one base exception with a subclass per variant, so a caller can - write `except ErrorException.Timeout`, as PyO3 and UniFFI packages do. -- Objects and records can be weakly referenced: `weakref.ref(obj)` works, through - `__weaklistoffset__` in `Py_tp_members` for objects and a weakref slot for records. -- Records no longer go through `@dataclass` at import: the generator writes `__init__`, - `__eq__`, `__repr__`, `__match_args__`, and `__dataclass_fields__`, so - `dataclasses.replace` and `fields` keep working. Report `import moq`'s time before and - after. -- An await under trio, or any loop the binding does not support, raises an error naming - asyncio instead of an unrelated weakref `TypeError`. - -## Plan - -Found by the 2026-11-18 language audit: all 25 of moq's `*Exception` classes subclass -`Exception` directly; `weakref.ref(moq.WaiterList.new())` raises `TypeError`; profiling -`import moq` on CPython 3.14.10 put 58 of 91 ms in processing 163 `@dataclass` -declarations. - -Decided with the maintainer on 2026-11-18: ✅ breaking changes land in this epic before -moq pins, as soon as possible (rejected: after the pin). - -Public API: breaking for code that catches a variant's exception by its old class. diff --git a/quest/m1/ffi-export/ship.md b/quest/m1/ffi-export/ship.md index 786484b07..fd9dfc2a3 100644 --- a/quest/m1/ffi-export/ship.md +++ b/quest/m1/ffi-export/ship.md @@ -22,7 +22,6 @@ then see change. A sibling planned later adds itself to `Required` here. - [Refusals](/quest/m1/ffi-refusals/README.md) - the census lists no refusals at the moq pin, and `ffi.toml` is gone - [C and C++ idioms](/quest/m1/ffi-export/cpp-idioms.md) - numeric slice views and must-use returns change the C++ API - [Swift spans](/quest/m1/ffi-export/swift-span.md) - lent bytes and slices change the Swift API -- [Python idioms](/quest/m1/ffi-export/python-idioms.md) - the exception hierarchy changes the Python API - [Dart analysis](/quest/m1/ffi-export/dart-analyze.md) - lint fixes may rename generated Dart - [Docs](/quest/m1/ffi-export/docs.md) - doc links and deprecations in every binding - [Niche values](/quest/m1/ffi-export/niche-values.md) - moq's `Timestamp` changes from a handle back to a value in every binding