diff --git a/compiler/erg_common/python_util.rs b/compiler/erg_common/python_util.rs index 74c11d4f..4d844747 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; 14] = [ +pub const BUILTIN_PYTHON_MODS: [&str; 15] = [ "glob", "http", "importlib", @@ -19,11 +19,12 @@ pub const BUILTIN_PYTHON_MODS: [&str; 14] = [ "socket", "subprocess", "sys", + "tarfile", "time", "urllib", ]; #[cfg(not(unix))] -pub const BUILTIN_PYTHON_MODS: [&str; 13] = [ +pub const BUILTIN_PYTHON_MODS: [&str; 14] = [ "glob", "http", "importlib", @@ -35,6 +36,7 @@ pub const BUILTIN_PYTHON_MODS: [&str; 13] = [ "socket", "subprocess", "sys", + "tarfile", "time", "urllib", ]; diff --git a/compiler/erg_compiler/lib/pystd/tarfile.d.er b/compiler/erg_compiler/lib/pystd/tarfile.d.er new file mode 100644 index 00000000..8de2091c --- /dev/null +++ b/compiler/erg_compiler/lib/pystd/tarfile.d.er @@ -0,0 +1,10 @@ +.TarFile!: ClassType +.TarFile!.open!: (path: PathLike or NoneType := NoneType, mode := Str) => .TarFile! +.TarFile!.add!: (self: RefMut(.TarFile!), name: PathLike, arcname: PathLike or NoneType := NoneType, recursive := Bool) => NoneType +.TarFile!.close!: (self: .TarFile!,) => NoneType +.TarFile!.extractall!: (self: RefMut(.TarFile!), path := PathLike, members: [Str; _] or NoneType := NoneType, numeric_owner := Bool) => NoneType +.TarFile!.getnames: (self: Ref(.TarFile!),) -> [Str; _] +.TarFile!.list: (self: Ref(.TarFile!), verbose := Bool) -> [Str; _] + +.open!: (path: PathLike or NoneType := NoneType, mode := Str) => .TarFile! +.is_tarfile: (name: Str or File!,) -> Bool