mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
feat: add tempfile
module
This commit is contained in:
parent
7e9cb513af
commit
30eac6dbcf
2 changed files with 66 additions and 0 deletions
|
@ -423,6 +423,13 @@ impl Context {
|
|||
Const,
|
||||
None,
|
||||
);
|
||||
self.register_builtin_type(
|
||||
mono(MUTABLE_IO),
|
||||
io,
|
||||
Visibility::BUILTIN_PRIVATE,
|
||||
Const,
|
||||
None,
|
||||
);
|
||||
self.register_builtin_type(
|
||||
mono(MUTABLE_WRITABLE),
|
||||
writable,
|
||||
|
|
59
crates/erg_compiler/lib/pystd/tempfile.d.er
Normal file
59
crates/erg_compiler/lib/pystd/tempfile.d.er
Normal file
|
@ -0,0 +1,59 @@
|
|||
io = pyimport "io"
|
||||
|
||||
._TemporaryFileWrapper!: ClassType
|
||||
._TemporaryFileWrapper! <: FileLike!
|
||||
._TemporaryFileWrapper!.
|
||||
name: Str
|
||||
delete: Bool
|
||||
file: io.BufferedRandom!
|
||||
close!: (self: ._TemporaryFileWrapper!) => NoneType
|
||||
|
||||
.TemporaryFile!: (
|
||||
mode := Str,
|
||||
buffering := Int,
|
||||
encoding := Str,
|
||||
newline := Str,
|
||||
suffix := Str,
|
||||
prefix := Str,
|
||||
dir := Str,
|
||||
) -> ._TemporaryFileWrapper!
|
||||
|
||||
.NamedTemporaryFile!: (
|
||||
mode := Str,
|
||||
buffering := Int,
|
||||
encoding := Str,
|
||||
newline := Str,
|
||||
suffix := Str,
|
||||
prefix := Str,
|
||||
dir := Str,
|
||||
delete := Bool,
|
||||
) -> ._TemporaryFileWrapper!
|
||||
|
||||
.TemporaryDirectory!: ClassType
|
||||
.TemporaryDirectory!.
|
||||
name: Str
|
||||
__call__: (
|
||||
suffix := Str,
|
||||
prefix := Str,
|
||||
dir := Str,
|
||||
) -> .TemporaryDirectory!
|
||||
cleanup!: (self: .TemporaryDirectory!) => NoneType
|
||||
|
||||
.mkstemp!: (
|
||||
suffix := Str,
|
||||
prefix := Str,
|
||||
dir := Str,
|
||||
text := Bool,
|
||||
) -> (Nat, Str)
|
||||
.mkdtemp!: (
|
||||
suffix := Str,
|
||||
prefix := Str,
|
||||
dir := Str,
|
||||
) -> Str
|
||||
|
||||
.gettempdir!: () => Str
|
||||
.gettempdirb!: () => Bytes
|
||||
.gettempprefix: () -> Str
|
||||
.gettempprefixb: () -> Bytes
|
||||
|
||||
.tempdir: Str or NoneType
|
Loading…
Add table
Add a link
Reference in a new issue