aboutsummaryrefslogtreecommitdiffstats
path: root/crates/yt_dlp
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-17 09:00:41 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-17 09:00:41 +0200
commit74ecf0ea1564343905a96dbd14826700762ec825 (patch)
treeca03e80d5fa81aae819fea6514088d286ae8304b /crates/yt_dlp
parentfix(yt_dlp/post_processing/dearrow): Correctly type the `CasualVote` field (diff)
downloadyt-74ecf0ea1564343905a96dbd14826700762ec825.zip
refactor(yt_dlp/progress_hook): Use public api via `__priv` module
That makes it clear that these parts are only exposed to facilitate macro use and not as part of the public API.
Diffstat (limited to 'crates/yt_dlp')
-rw-r--r--crates/yt_dlp/src/progress_hook.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/crates/yt_dlp/src/progress_hook.rs b/crates/yt_dlp/src/progress_hook.rs
index 4604223..6d2c9b7 100644
--- a/crates/yt_dlp/src/progress_hook.rs
+++ b/crates/yt_dlp/src/progress_hook.rs
@@ -12,21 +12,21 @@
macro_rules! mk_python_function {
($name:ident, $new_name:ident) => {
pub fn $new_name(
- mut args: $crate::progress_hook::rustpython::vm::function::FuncArgs,
- vm: &$crate::progress_hook::rustpython::vm::VirtualMachine,
+ mut args: $crate::progress_hook::__priv::vm::function::FuncArgs,
+ vm: &$crate::progress_hook::__priv::vm::VirtualMachine,
) {
- use $crate::progress_hook::rustpython;
+ use $crate::progress_hook::__priv::vm;
let input = {
- let dict: rustpython::vm::PyRef<rustpython::vm::builtins::PyDict> = args
+ let dict: vm::PyRef<vm::builtins::PyDict> = args
.args
.remove(0)
.downcast()
.expect("The progress hook is always called with these args");
- let new_dict = rustpython::vm::builtins::PyDict::new_ref(&vm.ctx);
+ let new_dict = vm::builtins::PyDict::new_ref(&vm.ctx);
dict.into_iter()
.filter_map(|(name, value)| {
- let real_name: rustpython::vm::PyRefExact<rustpython::vm::builtins::PyStr> =
+ let real_name: vm::PyRefExact<vm::builtins::PyStr> =
name.downcast_exact(vm).expect("Is a string");
let name_str = real_name.to_str().expect("Is a string");
if name_str.starts_with('_') {
@@ -41,14 +41,13 @@ macro_rules! mk_python_function {
.expect("This is a transpositions, should always be valid");
});
- $crate::json_dumps(new_dict, vm)
+ $crate::progress_hook::__priv::json_dumps(new_dict, vm)
};
$name(input).expect("Shall not fail!");
}
};
}
-pub use rustpython;
pub mod __priv {
pub use crate::{json_dumps, json_loads};
pub use rustpython::vm;