diff --git a/compiler/erg_common/python_util.rs b/compiler/erg_common/python_util.rs index 069c662e..b9d92026 100644 --- a/compiler/erg_common/python_util.rs +++ b/compiler/erg_common/python_util.rs @@ -6,7 +6,7 @@ use std::process::Command; use crate::serialize::get_magic_num_from_bytes; #[cfg(unix)] -pub const BUILTIN_PYTHON_MODS: [&str; 16] = [ +pub const BUILTIN_PYTHON_MODS: [&str; 17] = [ "glob", "http", "importlib", @@ -23,9 +23,10 @@ pub const BUILTIN_PYTHON_MODS: [&str; 16] = [ "tarfile", "time", "urllib", + "zipfile", ]; #[cfg(not(unix))] -pub const BUILTIN_PYTHON_MODS: [&str; 15] = [ +pub const BUILTIN_PYTHON_MODS: [&str; 16] = [ "glob", "http", "importlib", @@ -41,6 +42,7 @@ pub const BUILTIN_PYTHON_MODS: [&str; 15] = [ "tarfile", "time", "urllib", + "zipfile", ]; pub fn which_python() -> String { diff --git a/compiler/erg_compiler/lib/pystd/zipfile.d.er b/compiler/erg_compiler/lib/pystd/zipfile.d.er new file mode 100644 index 00000000..17792f36 --- /dev/null +++ b/compiler/erg_compiler/lib/pystd/zipfile.d.er @@ -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