diff --git a/crates/erg_compiler/context/initialize/traits.rs b/crates/erg_compiler/context/initialize/traits.rs index 0dd53fad9..f9b0c56e0 100644 --- a/crates/erg_compiler/context/initialize/traits.rs +++ b/crates/erg_compiler/context/initialize/traits.rs @@ -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, diff --git a/crates/erg_compiler/lib/pystd/tempfile.d.er b/crates/erg_compiler/lib/pystd/tempfile.d.er new file mode 100644 index 000000000..1b8dd7195 --- /dev/null +++ b/crates/erg_compiler/lib/pystd/tempfile.d.er @@ -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