Skip to content

Commit

Permalink
feat: add shlex/pickle/marshal
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Sep 9, 2023
1 parent 4c58699 commit 5d39c17
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/erg_compiler/lib/pystd/marshal.d.er
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.version: Nat

.dump!: (value: Obj, file := PathLike, version := Nat) => NoneType
.load!: (file: PathLike) => Obj
.dumps: (value: Obj, version := Nat) -> Bytes
.loads: (bytes: Bytes) -> Obj
17 changes: 17 additions & 0 deletions crates/erg_compiler/lib/pystd/pickle.d.er
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.HIGHEST_PROTOCOL: Nat
.DEFAULT_PROTOCOL: Nat

.dump!: (obj: Obj, file: PathLike, protocol := Nat) => NoneType
.dumps: (obj: Obj, protocol := Nat) -> Bytes
.load!: (
file: PathLike,
fix_imports := Bool,
encoding := Str,
errors := Str,
) => Obj
.loads: (
data: Bytes,
fix_imports := Bool,
encoding := Str,
errors := Str
) -> Obj
18 changes: 18 additions & 0 deletions crates/erg_compiler/lib/pystd/shlex.d.er
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.Shlex! = 'shlex': ClassType
.Shlex!.
commenters: Str
wordchars: Str
whitespace: Str
escape: Str
quotes: Str
escapedquotes: Str
whitespace_split: Bool
infile: Str
__call__: (instream := Str, posix := Bool, punctuation_chars := Bool) -> .Shlex!
get_token!: (self: RefMut(.Shlex!)) => Str
push_token!: (self: RefMut(.Shlex!), token: Str) => NoneType
read_token!: (self: RefMut(.Shlex!)) => Str

.split: (s: Str, comments := Bool, posix := Bool) -> [Str; _]
.join: (split_command: Iterable(Str)) -> Str
.quote: (s: Str) -> Str

0 comments on commit 5d39c17

Please sign in to comment.