feat: add codecs/warnings module

This commit is contained in:
Shunsuke Shibayama 2024-09-21 21:42:54 +09:00
parent 3366043a2d
commit cdabb2e546
3 changed files with 160 additions and 0 deletions

View file

@ -0,0 +1,84 @@
.BOM: Bytes
.BOM_BE: Bytes
.BOM_LE: Bytes
.BOM_UTF8: Bytes
.BOM_UTF16: Bytes
.BOM_UTF16_BE: Bytes
.BOM_UTF16_LE: Bytes
.BOM_UTF32: Bytes
.BOM_UTF32_BE: Bytes
.BOM_UTF32_LE: Bytes
.EncodedFile: ClassType
.StreamReader!: ClassType
.StreamReader!.
read!: (self: RefMut StreamReader!, size := Int, chars := Int, firstline := Bool) => Bytes
readline!: (self: RefMut StreamReader!, size := Int, keepends := Bool) => Bytes
readlines!: (self: RefMut StreamReader!, sizehint := Int, keepends := Bool) => List Bytes
reset!: (self: RefMut StreamReader!) => NoneType
__iter__: (self: Ref StreamReader!) => Iterator Bytes
.StreamWriter!: ClassType
.StreamWriter!.
write!: (self: RefMut StreamWriter!, obj: Bytes) => Int
writelines!: (self: RefMut StreamWriter!, obj: List Bytes) => NoneType
reset!: (self: RefMut StreamWriter!) => NoneType
.StreamReaderWriter!: ClassType
.StreamReaderWriter!.
read!: (self: RefMut StreamReaderWriter!, size := Int, chars := Int, firstline := Bool) => Bytes
readline!: (self: RefMut StreamReaderWriter!, size := Int, keepends := Bool) => Bytes
readlines!: (self: RefMut StreamReaderWriter!, sizehint := Int, keepends := Bool) => List Bytes
write!: (self: RefMut StreamReaderWriter!, obj: Bytes) => Int
writelines!: (self: RefMut StreamReaderWriter!, obj: List Bytes) => NoneType
reset!: (self: RefMut StreamReaderWriter!) => NoneType
__iter__: (self: Ref StreamReaderWriter!) => Iterator Bytes
.Codec: ClassType
.Codec.
name: Str
encode: (obj: Str, errors := Str) -> Bytes
decode: (obj: Bytes, errors := Str) -> Str
.CodecInfo: ClassType
.CodecInfo.
name: Str
encode: (obj: Str, encoding := Str, errors := Str) -> Bytes
decode: (obj: Bytes, encoding := Str, errors:= Str) -> Str
streamreader: (obj: Bytes, errors: Str) -> StreamReader!
streamwriter: (obj: Bytes, errors: Str) -> StreamWriter!
__call__: (
encode: (obj: Str, encoding := Str, errors := Str) -> Bytes,
decode: (obj: Bytes, encoding := Str, errors := Str) -> Str,
streamreader := StreamReader!,
streamwriter := StreamWriter!,
incrementalencoder := IncrementalEncoder,
incrementaldecoder := IncrementalDecoder,
name := Str,
) -> CodecInfo
.IncrementalEncoder: ClassType
.IncrementalEncoder.
encode: (obj: Str, final := Bool) -> Bytes
.IncrementalDecoder: ClassType
.IncrementalDecoder.
decode: (obj: Bytes, final := Bool) -> Str
.BufferedIncrementalEncoder: ClassType
.BufferedIncrementalEncoder <: IncrementalEncoder
.BufferedIncrementalDecoder: ClassType
.BufferedIncrementalDecoder <: IncrementalDecoder
.encode: (obj: Str, encoding := Str, errors := Str) -> Bytes
.decode: (obj: Bytes, encoding := Str, errors := Str) -> Str
.lookup: (encoding: Str) -> CodecInfo
.getencoder: (encoding: Str) -> (obj: Str) -> (Bytes, Nat)
.getdecoder: (encoding: Str) -> (obj: Bytes) -> (Str, Nat)
.open!: (filename: Str, mode := Str, encoding := Str, errors := Str, buffering := Int) -> StreamReaderWriter!
.register!: (search_function: (name: Str) -> CodecInfo or NoneType) => NoneType
.unregister!: (search_function: (name: Str) -> CodecInfo or NoneType) => NoneType

View file

@ -1,7 +1,31 @@
.OPENSSL_VERSION: Str
.OPENSSL_VERSION_INFO: (Nat, Nat, Nat)
.SSLContext: ClassType
.create_default_context!: () => .SSLContext
.SSLError: ClassType
.SSLError <: OSError
.SSLZeroReturnError: ClassType
.SSLZeroReturnError <: SSLError
.SSLWantReadError: ClassType
.SSLWantReadError <: SSLError
.SSLWantWriteError: ClassType
.SSLWantWriteError <: SSLError
.SSLSyscallError: ClassType
.SSLSyscallError <: SSLError
.SSLEOFError: ClassType
.SSLEOFError <: SSLError
.SSLCertVerificationError: ClassType
.SSLCertVerificationError <: SSLError
.CertificateError = .SSLCertVerificationError
.SSLSocket: ClassType
.SSLSocket <: FileLike!

View file

@ -0,0 +1,52 @@
.CatchWarnings = 'catch_warnings': ClassType
.CatchWarnings.
__call__: () => CatchWarnings
.catch_warnings!: () => CatchWarnings
.warn!: (
message: Str,
category := Exception,
stacklevel := Nat,
source := Obj,
skip_file_prefixes := Iterable(Str),
) => NoneType
.warn_explicit!: (
message: Str,
category: Exception,
filename: Str,
lineno: Nat,
module := Str,
registry := GenericDict,
module_globals := GenericDict,
source := Obj,
) => NoneType
.showwarning!: (
message: Str,
category: Exception,
filename: Str,
lineno: Nat,
file := FileLike!,
line := Str,
) => NoneType
.formatwarning!: (
message: Str,
category: Exception,
filename: Str,
lineno: Nat,
line := Str,
) => Str
.filterwarnings!: (
action: Str,
message := Str,
category := Exception,
module := Str,
lineno := Nat,
append := Bool,
) => NoneType
.simplefilter!: (
action: Str,
category := Exception,
lineno := Nat,
append := Bool,
) => NoneType
.resetwarnings!: () => NoneType