mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
feat: add contextlib
This commit is contained in:
parent
1eabc1f0c0
commit
d03dcbd392
3 changed files with 31 additions and 6 deletions
12
crates/erg_compiler/lib/pystd/contextlib.d.er
Normal file
12
crates/erg_compiler/lib/pystd/contextlib.d.er
Normal file
|
@ -0,0 +1,12 @@
|
|||
.contextmanager: |F <: GenericCallable|(F) -> F
|
||||
.closing!: |T|(thing: Structural { .close = (self: T) -> Obj }) => NoneType
|
||||
|
||||
.ExitStack!: ClassType
|
||||
.ExitStack! <: ContextManager
|
||||
.ExitStack!.
|
||||
__call__: () -> .ExitStack!
|
||||
enter_context!: (self: .ExitStack!, cm: ContextManager) => NoneType
|
||||
push!: (self: .ExitStack!, exit: GenericCallable) => NoneType
|
||||
callback!: (self: .ExitStack!, callback: GenericCallable) => NoneType
|
||||
pop_all!: (self: .ExitStack!) => [GenericCallable; _]
|
||||
close!: (self: .ExitStack!) => NoneType
|
Loading…
Add table
Add a link
Reference in a new issue