Add zipfile module

This commit is contained in:
Shunsuke Shibayama 2022-10-20 17:02:57 +09:00
parent 1c2014f7ca
commit 48eb3c5920
2 changed files with 14 additions and 2 deletions

View file

@ -6,7 +6,7 @@ use std::process::Command;
use crate::serialize::get_magic_num_from_bytes; use crate::serialize::get_magic_num_from_bytes;
#[cfg(unix)] #[cfg(unix)]
pub const BUILTIN_PYTHON_MODS: [&str; 16] = [ pub const BUILTIN_PYTHON_MODS: [&str; 17] = [
"glob", "glob",
"http", "http",
"importlib", "importlib",
@ -23,9 +23,10 @@ pub const BUILTIN_PYTHON_MODS: [&str; 16] = [
"tarfile", "tarfile",
"time", "time",
"urllib", "urllib",
"zipfile",
]; ];
#[cfg(not(unix))] #[cfg(not(unix))]
pub const BUILTIN_PYTHON_MODS: [&str; 15] = [ pub const BUILTIN_PYTHON_MODS: [&str; 16] = [
"glob", "glob",
"http", "http",
"importlib", "importlib",
@ -41,6 +42,7 @@ pub const BUILTIN_PYTHON_MODS: [&str; 15] = [
"tarfile", "tarfile",
"time", "time",
"urllib", "urllib",
"zipfile",
]; ];
pub fn which_python() -> String { pub fn which_python() -> String {

View file

@ -0,0 +1,10 @@
.ZipFile!: ClassType
.ZipFile! <: FileLike!
.ZipFile!.open!: (path: PathLike or NoneType := NoneType, mode := Str) => .ZipFile!
.ZipFile!.add!: (self: RefMut(.ZipFile!), name: PathLike, arcname: PathLike or NoneType := NoneType, recursive := Bool) => NoneType
.ZipFile!.close!: (self: .ZipFile!,) => NoneType
.ZipFile!.extractall!: (self: RefMut(.ZipFile!), path := PathLike, members: [Str; _] or NoneType := NoneType, numeric_owner := Bool) => NoneType
.ZipFile!.namelist: (self: Ref(.ZipFile!),) -> [Str; _]
.is_zipfile: (name: Str or File!,) -> Bool