mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +00:00
Add zipfile
module
This commit is contained in:
parent
1c2014f7ca
commit
48eb3c5920
2 changed files with 14 additions and 2 deletions
|
@ -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 {
|
||||||
|
|
10
compiler/erg_compiler/lib/pystd/zipfile.d.er
Normal file
10
compiler/erg_compiler/lib/pystd/zipfile.d.er
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue