pythonia
Version:
Bridge to call and interop Python APIs from Node.js
1,403 lines (1,325 loc) • 443 kB
TypeScript
declare type sqlite3_default = typeof sqlite3.dbapi2
declare type tkinter_default = typeof tkinter.constants
declare module base64 {
var _
/**
* Encode the bytes-like object s using Base64 and return a bytes object.
*
* Optional altchars should be a byte string of length 2 which specifies an
* alternative alphabet for the '+' and '/' characters. This allows an
* application to e.g. generate url or filesystem safe Base64 strings.
*
*/
function b64encode(s, altchars?): Promise<any>
function b64encode$({ s, altchars }: { s, altchars?}): Promise<any>
/**
* Decode the Base64 encoded bytes-like object or ASCII string s.
*
* Optional altchars must be a bytes-like object or ASCII string of length 2
* which specifies the alternative alphabet used instead of the '+' and '/'
* characters.
*
* The result is returned as a bytes object. A binascii.Error is raised if
* s is incorrectly padded.
*
* If validate is False (the default), characters that are neither in the
* normal base-64 alphabet nor the alternative alphabet are discarded prior
* to the padding check. If validate is True, these non-alphabet characters
* in the input result in a binascii.Error.
*
*/
function b64decode(s, altchars?, validate?: boolean): Promise<any>
function b64decode$({ s, altchars, validate }: { s, altchars?, validate?}): Promise<any>
/**
* Encode bytes-like object s using the standard Base64 alphabet.
*
* The result is returned as a bytes object.
*
*/
function standard_b64encode(s): Promise<any>
function standard_b64encode$({ s }): Promise<any>
/**
* Decode bytes encoded with the standard Base64 alphabet.
*
* Argument s is a bytes-like object or ASCII string to decode. The result
* is returned as a bytes object. A binascii.Error is raised if the input
* is incorrectly padded. Characters that are not in the standard alphabet
* are discarded prior to the padding check.
*
*/
function standard_b64decode(s): Promise<any>
function standard_b64decode$({ s }): Promise<any>
/**
* Encode bytes using the URL- and filesystem-safe Base64 alphabet.
*
* Argument s is a bytes-like object to encode. The result is returned as a
* bytes object. The alphabet uses '-' instead of '+' and '_' instead of
* '/'.
*
*/
function urlsafe_b64encode(s): Promise<any>
function urlsafe_b64encode$({ s }): Promise<any>
/**
* Decode bytes using the URL- and filesystem-safe Base64 alphabet.
*
* Argument s is a bytes-like object or ASCII string to decode. The result
* is returned as a bytes object. A binascii.Error is raised if the input
* is incorrectly padded. Characters that are not in the URL-safe base-64
* alphabet, and are not a plus '+' or slash '/', are discarded prior to the
* padding check.
*
* The alphabet uses '-' instead of '+' and '_' instead of '/'.
*
*/
function urlsafe_b64decode(s): Promise<any>
function urlsafe_b64decode$({ s }): Promise<any>
function b32encode(s): Promise<any>
function b32encode$({ s }): Promise<any>
function b32decode(s, casefold?: boolean, map01?): Promise<any>
function b32decode$({ s, casefold, map01 }: { s, casefold?, map01?}): Promise<any>
function b32hexencode(s): Promise<any>
function b32hexencode$({ s }): Promise<any>
function b32hexdecode(s, casefold?: boolean): Promise<any>
function b32hexdecode$({ s, casefold }: { s, casefold?}): Promise<any>
/**
* Encode the bytes-like object s using Base16 and return a bytes object.
*
*/
function b16encode(s): Promise<any>
function b16encode$({ s }): Promise<any>
/**
* Decode the Base16 encoded bytes-like object or ASCII string s.
*
* Optional casefold is a flag specifying whether a lowercase alphabet is
* acceptable as input. For security purposes, the default is False.
*
* The result is returned as a bytes object. A binascii.Error is raised if
* s is incorrectly padded or if there are non-alphabet characters present
* in the input.
*
*/
function b16decode(s, casefold?: boolean): Promise<any>
function b16decode$({ s, casefold }: { s, casefold?}): Promise<any>
/**
* Encode bytes-like object b using Ascii85 and return a bytes object.
*
* foldspaces is an optional flag that uses the special short sequence 'y'
* instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
* feature is not supported by the "standard" Adobe encoding.
*
* wrapcol controls whether the output should have newline (b'\n') characters
* added to it. If this is non-zero, each output line will be at most this
* many characters long.
*
* pad controls whether the input is padded to a multiple of 4 before
* encoding. Note that the btoa implementation always pads.
*
* adobe controls whether the encoded byte sequence is framed with <~ and ~>,
* which is used by the Adobe implementation.
*
*/
function a85encode(b): Promise<any>
function a85encode$({ b }): Promise<any>
/**
* Decode the Ascii85 encoded bytes-like object or ASCII string b.
*
* foldspaces is a flag that specifies whether the 'y' short sequence should be
* accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is
* not supported by the "standard" Adobe encoding.
*
* adobe controls whether the input sequence is in Adobe Ascii85 format (i.e.
* is framed with <~ and ~>).
*
* ignorechars should be a byte string containing characters to ignore from the
* input. This should only contain whitespace characters, and by default
* contains all whitespace characters in ASCII.
*
* The result is returned as a bytes object.
*
*/
function a85decode(b): Promise<any>
function a85decode$({ b }): Promise<any>
/**
* Encode bytes-like object b in base85 format and return a bytes object.
*
* If pad is true, the input is padded with b'\0' so its length is a multiple of
* 4 bytes before encoding.
*
*/
function b85encode(b, pad?: boolean): Promise<any>
function b85encode$({ b, pad }: { b, pad?}): Promise<any>
/**
* Decode the base85-encoded bytes-like object or ASCII string b
*
* The result is returned as a bytes object.
*
*/
function b85decode(b): Promise<any>
function b85decode$({ b }): Promise<any>
/**
* Encode a file; input and output are binary files.
*/
function encode(input, output): Promise<any>
function encode$({ input, output }): Promise<any>
/**
* Decode a file; input and output are binary files.
*/
function decode(input, output): Promise<any>
function decode$({ input, output }): Promise<any>
/**
* Encode a bytestring into a bytes object containing multiple lines
* of base-64 data.
*/
function encodebytes(s): Promise<any>
function encodebytes$({ s }): Promise<any>
/**
* Decode a bytestring of base-64 data into a bytes object.
*/
function decodebytes(s): Promise<any>
function decodebytes$({ s }): Promise<any>
/**
* Small main program
*/
function main(): Promise<any>
function main$($: {}): Promise<any>
function test(): Promise<any>
function test$($: {}): Promise<any>
let bytes_types: Promise<any>
let MAXLINESIZE: Promise<any>
let MAXBINSIZE: Promise<any>
}
declare module codecs {
var _
/**
* Open an encoded file using the given mode and return
* a wrapped version providing transparent encoding/decoding.
*
* Note: The wrapped version will only accept the object format
* defined by the codecs, i.e. Unicode objects for most builtin
* codecs. Output is also codec dependent and will usually be
* Unicode as well.
*
* Underlying encoded files are always opened in binary mode.
* The default file mode is 'r', meaning to open the file in read mode.
*
* encoding specifies the encoding which is to be used for the
* file.
*
* errors may be given to define the error handling. It defaults
* to 'strict' which causes ValueErrors to be raised in case an
* encoding error occurs.
*
* buffering has the same meaning as for the builtin open() API.
* It defaults to -1 which means that the default buffer size will
* be used.
*
* The returned wrapped file object provides an extra attribute
* .encoding which allows querying the used encoding. This
* attribute is only available if an encoding was specified as
* parameter.
*
*
*/
function open(filename, mode?, encoding?, errors?, buffering?): Promise<any>
function open$({ filename, mode, encoding, errors, buffering }: { filename, mode?, encoding?, errors?, buffering?}): Promise<any>
/**
* Return a wrapped version of file which provides transparent
* encoding translation.
*
* Data written to the wrapped file is decoded according
* to the given data_encoding and then encoded to the underlying
* file using file_encoding. The intermediate data type
* will usually be Unicode but depends on the specified codecs.
*
* Bytes read from the file are decoded using file_encoding and then
* passed back to the caller encoded using data_encoding.
*
* If file_encoding is not given, it defaults to data_encoding.
*
* errors may be given to define the error handling. It defaults
* to 'strict' which causes ValueErrors to be raised in case an
* encoding error occurs.
*
* The returned wrapped file object provides two extra attributes
* .data_encoding and .file_encoding which reflect the given
* parameters of the same name. The attributes can be used for
* introspection by Python programs.
*
*
*/
function EncodedFile(file, data_encoding, file_encoding?, errors?): Promise<any>
function EncodedFile$({ file, data_encoding, file_encoding, errors }: { file, data_encoding, file_encoding?, errors?}): Promise<any>
/**
* Lookup up the codec for the given encoding and return
* its encoder function.
*
* Raises a LookupError in case the encoding cannot be found.
*
*
*/
function getencoder(encoding): Promise<any>
function getencoder$({ encoding }): Promise<any>
/**
* Lookup up the codec for the given encoding and return
* its decoder function.
*
* Raises a LookupError in case the encoding cannot be found.
*
*
*/
function getdecoder(encoding): Promise<any>
function getdecoder$({ encoding }): Promise<any>
/**
* Lookup up the codec for the given encoding and return
* its IncrementalEncoder class or factory function.
*
* Raises a LookupError in case the encoding cannot be found
* or the codecs doesn't provide an incremental encoder.
*
*
*/
function getincrementalencoder(encoding): Promise<any>
function getincrementalencoder$({ encoding }): Promise<any>
/**
* Lookup up the codec for the given encoding and return
* its IncrementalDecoder class or factory function.
*
* Raises a LookupError in case the encoding cannot be found
* or the codecs doesn't provide an incremental decoder.
*
*
*/
function getincrementaldecoder(encoding): Promise<any>
function getincrementaldecoder$({ encoding }): Promise<any>
/**
* Lookup up the codec for the given encoding and return
* its StreamReader class or factory function.
*
* Raises a LookupError in case the encoding cannot be found.
*
*
*/
function getreader(encoding): Promise<any>
function getreader$({ encoding }): Promise<any>
/**
* Lookup up the codec for the given encoding and return
* its StreamWriter class or factory function.
*
* Raises a LookupError in case the encoding cannot be found.
*
*
*/
function getwriter(encoding): Promise<any>
function getwriter$({ encoding }): Promise<any>
/**
*
* Encoding iterator.
*
* Encodes the input strings from the iterator using an IncrementalEncoder.
*
* errors and kwargs are passed through to the IncrementalEncoder
* constructor.
*
*/
function iterencode(iterator, encoding, errors?): Promise<any>
function iterencode$({ iterator, encoding, errors }: { iterator, encoding, errors?}): Promise<any>
/**
*
* Decoding iterator.
*
* Decodes the input strings from the iterator using an IncrementalDecoder.
*
* errors and kwargs are passed through to the IncrementalDecoder
* constructor.
*
*/
function iterdecode(iterator, encoding, errors?): Promise<any>
function iterdecode$({ iterator, encoding, errors }: { iterator, encoding, errors?}): Promise<any>
/**
* make_identity_dict(rng) -> dict
*
* Return a dictionary where elements of the rng sequence are
* mapped to themselves.
*
*
*/
function make_identity_dict(rng): Promise<any>
function make_identity_dict$({ rng }): Promise<any>
/**
* Creates an encoding map from a decoding map.
*
* If a target mapping in the decoding map occurs multiple
* times, then that target is mapped to None (undefined mapping),
* causing an exception when encountered by the charmap codec
* during translation.
*
* One example where this happens is cp875.py which decodes
* multiple character to \u001a.
*
*
*/
function make_encoding_map(decoding_map): Promise<any>
function make_encoding_map$({ decoding_map }): Promise<any>
/**
* Codec details when looking up the codec registry
*/
interface ICodecInfo {
}
/**
* Defines the interface for stateless encoders/decoders.
*
* The .encode()/.decode() methods may use different error
* handling schemes by providing the errors argument. These
* string values are predefined:
*
* 'strict' - raise a ValueError error (or a subclass)
* 'ignore' - ignore the character and continue with the next
* 'replace' - replace with a suitable replacement character;
* Python will use the official U+FFFD REPLACEMENT
* CHARACTER for the builtin Unicode codecs on
* decoding and '?' on encoding.
* 'surrogateescape' - replace with private code points U+DCnn.
* 'xmlcharrefreplace' - Replace with the appropriate XML
* character reference (only for encoding).
* 'backslashreplace' - Replace with backslashed escape sequences.
* 'namereplace' - Replace with \N{...} escape sequences
* (only for encoding).
*
* The set of allowed values can be extended via register_error.
*
*
*/
interface ICodec {
/**
* Encodes the object input and returns a tuple (output
* object, length consumed).
*
* errors defines the error handling to apply. It defaults to
* 'strict' handling.
*
* The method may not store state in the Codec instance. Use
* StreamWriter for codecs which have to keep state in order to
* make encoding efficient.
*
* The encoder must be able to handle zero length input and
* return an empty object of the output object type in this
* situation.
*
*
*/
encode(input, errors?): Promise<any>
encode$({ input, errors }: { input, errors?}): Promise<any>
/**
* Decodes the object input and returns a tuple (output
* object, length consumed).
*
* input must be an object which provides the bf_getreadbuf
* buffer slot. Python strings, buffer objects and memory
* mapped files are examples of objects providing this slot.
*
* errors defines the error handling to apply. It defaults to
* 'strict' handling.
*
* The method may not store state in the Codec instance. Use
* StreamReader for codecs which have to keep state in order to
* make decoding efficient.
*
* The decoder must be able to handle zero length input and
* return an empty object of the output object type in this
* situation.
*
*
*/
decode(input, errors?): Promise<any>
decode$({ input, errors }: { input, errors?}): Promise<any>
}
/**
*
* An IncrementalEncoder encodes an input in multiple steps. The input can
* be passed piece by piece to the encode() method. The IncrementalEncoder
* remembers the state of the encoding process between calls to encode().
*
*/
/**
*
* Creates an IncrementalEncoder instance.
*
* The IncrementalEncoder may use different error handling schemes by
* providing the errors keyword argument. See the module docstring
* for a list of possible values.
*
*/
function IncrementalEncoder(errors?): Promise<IIncrementalEncoder>
function IncrementalEncoder$({ errors }: { errors?}): Promise<IIncrementalEncoder>
interface IIncrementalEncoder {
/**
*
* Encodes input and returns the resulting object.
*
*/
encode(input, final?: boolean): Promise<any>
encode$({ input, final }: { input, final?}): Promise<any>
/**
*
* Resets the encoder to the initial state.
*
*/
reset(): Promise<any>
reset$($: {}): Promise<any>
/**
*
* Return the current state of the encoder.
*
*/
getstate(): Promise<any>
getstate$($: {}): Promise<any>
/**
*
* Set the current state of the encoder. state must have been
* returned by getstate().
*
*/
setstate(state): Promise<any>
setstate$({ state }): Promise<any>
}
/**
*
* This subclass of IncrementalEncoder can be used as the baseclass for an
* incremental encoder if the encoder must keep some of the output in a
* buffer between calls to encode().
*
*/
function BufferedIncrementalEncoder(errors?): Promise<IBufferedIncrementalEncoder>
function BufferedIncrementalEncoder$({ errors }: { errors?}): Promise<IBufferedIncrementalEncoder>
interface IBufferedIncrementalEncoder extends IIncrementalEncoder {
encode(input, final?: boolean): Promise<any>
encode$({ input, final }: { input, final?}): Promise<any>
reset(): Promise<any>
reset$($: {}): Promise<any>
getstate(): Promise<any>
getstate$($: {}): Promise<any>
setstate(state): Promise<any>
setstate$({ state }): Promise<any>
}
/**
*
* An IncrementalDecoder decodes an input in multiple steps. The input can
* be passed piece by piece to the decode() method. The IncrementalDecoder
* remembers the state of the decoding process between calls to decode().
*
*/
/**
*
* Create an IncrementalDecoder instance.
*
* The IncrementalDecoder may use different error handling schemes by
* providing the errors keyword argument. See the module docstring
* for a list of possible values.
*
*/
function IncrementalDecoder(errors?): Promise<IIncrementalDecoder>
function IncrementalDecoder$({ errors }: { errors?}): Promise<IIncrementalDecoder>
interface IIncrementalDecoder {
/**
*
* Decode input and returns the resulting object.
*
*/
decode(input, final?: boolean): Promise<any>
decode$({ input, final }: { input, final?}): Promise<any>
/**
*
* Reset the decoder to the initial state.
*
*/
reset(): Promise<any>
reset$($: {}): Promise<any>
/**
*
* Return the current state of the decoder.
*
* This must be a (buffered_input, additional_state_info) tuple.
* buffered_input must be a bytes object containing bytes that
* were passed to decode() that have not yet been converted.
* additional_state_info must be a non-negative integer
* representing the state of the decoder WITHOUT yet having
* processed the contents of buffered_input. In the initial state
* and after reset(), getstate() must return (b"", 0).
*
*/
getstate(): Promise<any>
getstate$($: {}): Promise<any>
/**
*
* Set the current state of the decoder.
*
* state must have been returned by getstate(). The effect of
* setstate((b"", 0)) must be equivalent to reset().
*
*/
setstate(state): Promise<any>
setstate$({ state }): Promise<any>
}
/**
*
* This subclass of IncrementalDecoder can be used as the baseclass for an
* incremental decoder if the decoder must be able to handle incomplete
* byte sequences.
*
*/
function BufferedIncrementalDecoder(errors?): Promise<IBufferedIncrementalDecoder>
function BufferedIncrementalDecoder$({ errors }: { errors?}): Promise<IBufferedIncrementalDecoder>
interface IBufferedIncrementalDecoder extends IIncrementalDecoder {
decode(input, final?: boolean): Promise<any>
decode$({ input, final }: { input, final?}): Promise<any>
reset(): Promise<any>
reset$($: {}): Promise<any>
getstate(): Promise<any>
getstate$($: {}): Promise<any>
setstate(state): Promise<any>
setstate$({ state }): Promise<any>
}
/**
* Creates a StreamWriter instance.
*
* stream must be a file-like object open for writing.
*
* The StreamWriter may use different error handling
* schemes by providing the errors keyword argument. These
* parameters are predefined:
*
* 'strict' - raise a ValueError (or a subclass)
* 'ignore' - ignore the character and continue with the next
* 'replace'- replace with a suitable replacement character
* 'xmlcharrefreplace' - Replace with the appropriate XML
* character reference.
* 'backslashreplace' - Replace with backslashed escape
* sequences.
* 'namereplace' - Replace with \N{...} escape sequences.
*
* The set of allowed parameter values can be extended via
* register_error.
*
*/
function StreamWriter(stream, errors?): Promise<IStreamWriter>
function StreamWriter$({ stream, errors }: { stream, errors?}): Promise<IStreamWriter>
interface IStreamWriter extends ICodec {
/**
* Writes the object's contents encoded to self.stream.
*
*/
write(object): Promise<any>
write$({ object }): Promise<any>
/**
* Writes the concatenated list of strings to the stream
* using .write().
*
*/
writelines(list): Promise<any>
writelines$({ list }): Promise<any>
/**
* Resets the codec buffers used for keeping internal state.
*
* Calling this method should ensure that the data on the
* output is put into a clean state, that allows appending
* of new fresh data without having to rescan the whole
* stream to recover state.
*
*
*/
reset(): Promise<any>
reset$($: {}): Promise<any>
seek(offset, whence?): Promise<any>
seek$({ offset, whence }: { offset, whence?}): Promise<any>
}
/**
* Creates a StreamReader instance.
*
* stream must be a file-like object open for reading.
*
* The StreamReader may use different error handling
* schemes by providing the errors keyword argument. These
* parameters are predefined:
*
* 'strict' - raise a ValueError (or a subclass)
* 'ignore' - ignore the character and continue with the next
* 'replace'- replace with a suitable replacement character
* 'backslashreplace' - Replace with backslashed escape sequences;
*
* The set of allowed parameter values can be extended via
* register_error.
*
*/
function StreamReader(stream, errors?): Promise<IStreamReader>
function StreamReader$({ stream, errors }: { stream, errors?}): Promise<IStreamReader>
interface IStreamReader extends ICodec {
decode(input, errors?): Promise<any>
decode$({ input, errors }: { input, errors?}): Promise<any>
/**
* Decodes data from the stream self.stream and returns the
* resulting object.
*
* chars indicates the number of decoded code points or bytes to
* return. read() will never return more data than requested,
* but it might return less, if there is not enough available.
*
* size indicates the approximate maximum number of decoded
* bytes or code points to read for decoding. The decoder
* can modify this setting as appropriate. The default value
* -1 indicates to read and decode as much as possible. size
* is intended to prevent having to decode huge files in one
* step.
*
* If firstline is true, and a UnicodeDecodeError happens
* after the first line terminator in the input only the first line
* will be returned, the rest of the input will be kept until the
* next call to read().
*
* The method should use a greedy read strategy, meaning that
* it should read as much data as is allowed within the
* definition of the encoding and the given size, e.g. if
* optional encoding endings or state markers are available
* on the stream, these should be read too.
*
*/
read(size?, chars?, firstline?: boolean): Promise<any>
read$({ size, chars, firstline }: { size?, chars?, firstline?}): Promise<any>
/**
* Read one line from the input stream and return the
* decoded data.
*
* size, if given, is passed as size argument to the
* read() method.
*
*
*/
readline(size?, keepends?: boolean): Promise<any>
readline$({ size, keepends }: { size?, keepends?}): Promise<any>
/**
* Read all lines available on the input stream
* and return them as a list.
*
* Line breaks are implemented using the codec's decoder
* method and are included in the list entries.
*
* sizehint, if given, is ignored since there is no efficient
* way to finding the true end-of-line.
*
*
*/
readlines(sizehint?, keepends?: boolean): Promise<any>
readlines$({ sizehint, keepends }: { sizehint?, keepends?}): Promise<any>
/**
* Resets the codec buffers used for keeping internal state.
*
* Note that no stream repositioning should take place.
* This method is primarily intended to be able to recover
* from decoding errors.
*
*
*/
reset(): Promise<any>
reset$($: {}): Promise<any>
/**
* Set the input stream's current position.
*
* Resets the codec buffers used for keeping state.
*
*/
seek(offset, whence?): Promise<any>
seek$({ offset, whence }: { offset, whence?}): Promise<any>
charbuffertype
}
/**
* StreamReaderWriter instances allow wrapping streams which
* work in both read and write modes.
*
* The design is such that one can use the factory functions
* returned by the codec.lookup() function to construct the
* instance.
*
*
*/
/**
* Creates a StreamReaderWriter instance.
*
* stream must be a Stream-like object.
*
* Reader, Writer must be factory functions or classes
* providing the StreamReader, StreamWriter interface resp.
*
* Error handling is done in the same way as defined for the
* StreamWriter/Readers.
*
*
*/
function StreamReaderWriter(stream, Reader, Writer, errors?): Promise<IStreamReaderWriter>
function StreamReaderWriter$({ stream, Reader, Writer, errors }: { stream, Reader, Writer, errors?}): Promise<IStreamReaderWriter>
interface IStreamReaderWriter {
read(size?): Promise<any>
read$({ size }: { size?}): Promise<any>
readline(size?): Promise<any>
readline$({ size }: { size?}): Promise<any>
readlines(sizehint?): Promise<any>
readlines$({ sizehint }: { sizehint?}): Promise<any>
write(data): Promise<any>
write$({ data }): Promise<any>
writelines(list): Promise<any>
writelines$({ list }): Promise<any>
reset(): Promise<any>
reset$($: {}): Promise<any>
seek(offset, whence?): Promise<any>
seek$({ offset, whence }: { offset, whence?}): Promise<any>
encoding
}
/**
* StreamRecoder instances translate data from one encoding to another.
*
* They use the complete set of APIs returned by the
* codecs.lookup() function to implement their task.
*
* Data written to the StreamRecoder is first decoded into an
* intermediate format (depending on the "decode" codec) and then
* written to the underlying stream using an instance of the provided
* Writer class.
*
* In the other direction, data is read from the underlying stream using
* a Reader instance and then encoded and returned to the caller.
*
*
*/
/**
* Creates a StreamRecoder instance which implements a two-way
* conversion: encode and decode work on the frontend (the
* data visible to .read() and .write()) while Reader and Writer
* work on the backend (the data in stream).
*
* You can use these objects to do transparent
* transcodings from e.g. latin-1 to utf-8 and back.
*
* stream must be a file-like object.
*
* encode and decode must adhere to the Codec interface; Reader and
* Writer must be factory functions or classes providing the
* StreamReader and StreamWriter interfaces resp.
*
* Error handling is done in the same way as defined for the
* StreamWriter/Readers.
*
*
*/
function StreamRecoder(stream, encode, decode, Reader, Writer, errors?): Promise<IStreamRecoder>
function StreamRecoder$({ stream, encode, decode, Reader, Writer, errors }: { stream, encode, decode, Reader, Writer, errors?}): Promise<IStreamRecoder>
interface IStreamRecoder {
read(size?): Promise<any>
read$({ size }: { size?}): Promise<any>
readline(size?): Promise<any>
readline$({ size }: { size?}): Promise<any>
readlines(sizehint?): Promise<any>
readlines$({ sizehint }: { sizehint?}): Promise<any>
write(data): Promise<any>
write$({ data }): Promise<any>
writelines(list): Promise<any>
writelines$({ list }): Promise<any>
reset(): Promise<any>
reset$($: {}): Promise<any>
seek(offset, whence?): Promise<any>
seek$({ offset, whence }: { offset, whence?}): Promise<any>
data_encoding
file_encoding
}
let BOM_UTF8: Promise<any>
let BOM_LE: Promise<any>
let BOM_UTF16_LE: Promise<any>
let BOM_BE: Promise<any>
let BOM_UTF16_BE: Promise<any>
let BOM_UTF32_LE: Promise<any>
let BOM_UTF32_BE: Promise<any>
let BOM: Promise<any>
let BOM_UTF16: Promise<any>
let BOM_UTF32: Promise<any>
let BOM32_LE: Promise<any>
let BOM32_BE: Promise<any>
let BOM64_LE: Promise<any>
let BOM64_BE: Promise<any>
let strict_errors: Promise<any>
let ignore_errors: Promise<any>
let replace_errors: Promise<any>
let xmlcharrefreplace_errors: Promise<any>
let backslashreplace_errors: Promise<any>
let namereplace_errors: Promise<any>
}
declare module colorsys {
var _
function rgb_to_yiq(r, g, b): Promise<any>
function rgb_to_yiq$({ r, g, b }): Promise<any>
function yiq_to_rgb(y, i, q): Promise<any>
function yiq_to_rgb$({ y, i, q }): Promise<any>
function rgb_to_hls(r, g, b): Promise<any>
function rgb_to_hls$({ r, g, b }): Promise<any>
function hls_to_rgb(h, l, s): Promise<any>
function hls_to_rgb$({ h, l, s }): Promise<any>
function rgb_to_hsv(r, g, b): Promise<any>
function rgb_to_hsv$({ r, g, b }): Promise<any>
function hsv_to_rgb(h, s, v): Promise<any>
function hsv_to_rgb$({ h, s, v }): Promise<any>
let ONE_THIRD: Promise<any>
let ONE_SIXTH: Promise<any>
let TWO_THIRD: Promise<any>
}
declare module crypt {
var _
/**
* Generate a salt for the specified method.
*
* If not specified, the strongest available method will be used.
*
*
*/
function mksalt(method?): Promise<any>
function mksalt$({ method }: { method?}): Promise<any>
/**
* Return a string representing the one-way hash of a password, with a salt
* prepended.
*
* If ``salt`` is not specified or is ``None``, the strongest
* available method will be selected and a salt generated. Otherwise,
* ``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as
* returned by ``crypt.mksalt()``.
*
*
*/
function crypt(word, salt?): Promise<any>
function crypt$({ word, salt }: { word, salt?}): Promise<any>
/**
* Class representing a salt method per the Modular Crypt Format or the
* legacy 2-character crypt method.
*/
interface I_Method {
}
let methods: Promise<any>
}
declare module decimal {
var _
}
declare module email {
module base64mime {
var _
/**
* Return the length of s when it is encoded with base64.
*/
function header_length(bytearray): Promise<any>
function header_length$({ bytearray }): Promise<any>
/**
* Encode a single header line with Base64 encoding in a given charset.
*
* charset names the character set to use to encode the header. It defaults
* to iso-8859-1. Base64 encoding is defined in RFC 2045.
*
*/
function header_encode(header_bytes, charset?): Promise<any>
function header_encode$({ header_bytes, charset }: { header_bytes, charset?}): Promise<any>
/**
* Encode a string with base64.
*
* Each line will be wrapped at, at most, maxlinelen characters (defaults to
* 76 characters).
*
* Each line of encoded text will end with eol, which defaults to "\n". Set
* this to "\r\n" if you will be using the result of this function directly
* in an email.
*
*/
function body_encode(s, maxlinelen?, eol?): Promise<any>
function body_encode$({ s, maxlinelen, eol }: { s, maxlinelen?, eol?}): Promise<any>
/**
* Decode a raw base64 string, returning a bytes object.
*
* This function does not parse a full MIME header value encoded with
* base64 (like =?iso-8859-1?b?bmloISBuaWgh?=) -- please use the high
* level email.header class for that functionality.
*
*/
function decode(string): Promise<any>
function decode$({ string }): Promise<any>
let CRLF: Promise<any>
let NL: Promise<any>
let EMPTYSTRING: Promise<any>
let MISC_LEN: Promise<any>
let body_decode: Promise<any>
let decodestring: Promise<any>
}
}
declare module encodings {
module base64_codec {
var _
function base64_encode(input, errors?): Promise<any>
function base64_encode$({ input, errors }: { input, errors?}): Promise<any>
function base64_decode(input, errors?): Promise<any>
function base64_decode$({ input, errors }: { input, errors?}): Promise<any>
function getregentry(): Promise<any>
function getregentry$($: {}): Promise<any>
interface ICodec {
encode(input, errors?): Promise<any>
encode$({ input, errors }: { input, errors?}): Promise<any>
decode(input, errors?): Promise<any>
decode$({ input, errors }: { input, errors?}): Promise<any>
}
interface IIncrementalEncoder {
encode(input, final?: boolean): Promise<any>
encode$({ input, final }: { input, final?}): Promise<any>
}
interface IIncrementalDecoder {
decode(input, final?: boolean): Promise<any>
decode$({ input, final }: { input, final?}): Promise<any>
}
interface IStreamWriter extends ICodec {
charbuffertype
}
interface IStreamReader extends ICodec {
}
}
module bz2_codec {
var _
function bz2_encode(input, errors?): Promise<any>
function bz2_encode$({ input, errors }: { input, errors?}): Promise<any>
function bz2_decode(input, errors?): Promise<any>
function bz2_decode$({ input, errors }: { input, errors?}): Promise<any>
function getregentry(): Promise<any>
function getregentry$($: {}): Promise<any>
interface ICodec {
encode(input, errors?): Promise<any>
encode$({ input, errors }: { input, errors?}): Promise<any>
decode(input, errors?): Promise<any>
decode$({ input, errors }: { input, errors?}): Promise<any>
}
function IncrementalEncoder(errors?): Promise<IIncrementalEncoder>
function IncrementalEncoder$({ errors }: { errors?}): Promise<IIncrementalEncoder>
interface IIncrementalEncoder {
encode(input, final?: boolean): Promise<any>
encode$({ input, final }: { input, final?}): Promise<any>
reset(): Promise<any>
reset$($: {}): Promise<any>
}
function IncrementalDecoder(errors?): Promise<IIncrementalDecoder>
function IncrementalDecoder$({ errors }: { errors?}): Promise<IIncrementalDecoder>
interface IIncrementalDecoder {
decode(input, final?: boolean): Promise<any>
decode$({ input, final }: { input, final?}): Promise<any>
reset(): Promise<any>
reset$($: {}): Promise<any>
}
interface IStreamWriter extends ICodec {
charbuffertype
}
interface IStreamReader extends ICodec {
}
}
module hex_codec {
var _
function hex_encode(input, errors?): Promise<any>
function hex_encode$({ input, errors }: { input, errors?}): Promise<any>
function hex_decode(input, errors?): Promise<any>
function hex_decode$({ input, errors }: { input, errors?}): Promise<any>
function getregentry(): Promise<any>
function getregentry$($: {}): Promise<any>
interface ICodec {
encode(input, errors?): Promise<any>
encode$({ input, errors }: { input, errors?}): Promise<any>
decode(input, errors?): Promise<any>
decode$({ input, errors }: { input, errors?}): Promise<any>
}
interface IIncrementalEncoder {
encode(input, final?: boolean): Promise<any>
encode$({ input, final }: { input, final?}): Promise<any>
}
interface IIncrementalDecoder {
decode(input, final?: boolean): Promise<any>
decode$({ input, final }: { input, final?}): Promise<any>
}
interface IStreamWriter extends ICodec {
charbuffertype
}
interface IStreamReader extends ICodec {
}
}
module palmos {
var _
function getregentry(): Promise<any>
function getregentry$($: {}): Promise<any>
interface ICodec {
encode(input, errors?): Promise<any>
encode$({ input, errors }: { input, errors?}): Promise<any>
decode(input, errors?): Promise<any>
decode$({ input, errors }: { input, errors?}): Promise<any>
}
interface IIncrementalEncoder {
encode(input, final?: boolean): Promise<any>
encode$({ input, final }: { input, final?}): Promise<any>
}
interface IIncrementalDecoder {
decode(input, final?: boolean): Promise<any>
decode$({ input, final }: { input, final?}): Promise<any>
}
interface IStreamWriter extends ICodec {
}
interface IStreamReader extends ICodec {
}
let decoding_table: Promise<any>
let encoding_table: Promise<any>
}
module quopri_codec {
var _
function quopri_encode(input, errors?): Promise<any>
function quopri_encode$({ input, errors }: { input, errors?}): Promise<any>
function quopri_decode(input, errors?): Promise<any>
function quopri_decode$({ input, errors }: { input, errors?}): Promise<any>
function getregentry(): Promise<any>
function getregentry$($: {}): Promise<any>
interface ICodec {
encode(input, errors?): Promise<any>
encode$({ input, errors }: { input, errors?}): Promise<any>
decode(input, errors?): Promise<any>
decode$({ input, errors }: { input, errors?}): Promise<any>
}
interface IIncrementalEncoder {
encode(input, final?: boolean): Promise<any>
encode$({ input, final }: { input, final?}): Promise<any>
}
interface IIncrementalDecoder {
decode(input, final?: boolean): Promise<any>
decode$({ input, final }: { input, final?}): Promise<any>
}
interface IStreamWriter extends ICodec {
charbuffertype
}
interface IStreamReader extends ICodec {
}
}
module uu_codec {
var _
function uu_encode(input, errors?, filename?, mode?): Promise<any>
function uu_encode$({ input, errors, filename, mode }: { input, errors?, filename?, mode?}): Promise<any>
function uu_decode(input, errors?): Promise<any>
function uu_decode$({ input, errors }: { input, errors?}): Promise<any>
function getregentry(): Promise<any>
function getregentry$($: {}): Promise<any>
interface ICodec {
encode(input, errors?): Promise<any>
encode$({ input, errors }: { input, errors?}): Promise<any>
decode(input, errors?): Promise<any>
decode$({ input, errors }: { input, errors?}): Promise<any>
}
interface IIncrementalEncoder {
encode(input, final?: boolean): Promise<any>
encode$({ input, final }: { input, final?}): Promise<any>
}
interface IIncrementalDecoder {
decode(input, final?: boolean): Promise<any>
decode$({ input, final }: { input, final?}): Promise<any>
}
interface IStreamWriter extends ICodec {
charbuffertype
}
interface IStreamReader extends ICodec {
}
}
module zlib_codec {
var _
function zlib_encode(input, errors?): Promise<any>
function zlib_encode$({ input, errors }: { input, errors?}): Promise<any>
function zlib_decode(input, errors?): Promise<any>
function zlib_decode$({ input, errors }: { input, errors?}): Promise<any>
function getregentry(): Promise<any>
function getregentry$($: {}): Promise<any>
interface ICodec {
encode(input, errors?): Promise<any>
encode$({ input, errors }: { input, errors?}): Promise<any>
decode(input, errors?): Promise<any>
decode$({ input, errors }: { input, errors?}): Promise<any>
}
function IncrementalEncoder(errors?): Promise<IIncrementalEncoder>
function IncrementalEncoder$({ errors }: { errors?}): Promise<IIncrementalEncoder>
interface IIncrementalEncoder {
encode(input, final?: boolean): Promise<any>
encode$({ input, final }: { input, final?}): Promise<any>
reset(): Promise<any>
reset$($: {}): Promise<any>
}
function IncrementalDecoder(errors?): Promise<IIncrementalDecoder>
function IncrementalDecoder$({ errors }: { errors?}): Promise<IIncrementalDecoder>
interface IIncrementalDecoder {
decode(input, final?: boolean): Promise<any>
decode$({ input, final }: { input, final?}): Promise<any>
reset(): Promise<any>
reset$($: {}): Promise<any>
}
interface IStreamWriter extends ICodec {
charbuffertype
}
interface IStreamReader extends ICodec {
}
}
}
declare module export {
var _
function export_json(tree, pretty_print ?: boolean): Promise < any >
function export_json$({ tree, pretty_print }: { tree, pretty_print?}): Promise<any>
function export_dict(tree): Promise<any>
function export_dict$({ tree }): Promise<any>
interface IDictExportVisitor {
visit(node): Promise<any>
visit$({ node }): Promise<any>
default_visit(node): Promise<any>
default_visit$({ node }): Promise<any>
default_visit_field(val): Promise<any>
default_visit_field$({ val }): Promise<any>
visit_str(val): Promise<any>
visit_str$({ val }): Promise<any>
visit_Bytes(val): Promise<any>
visit_Bytes$({ val }): Promise<any>
visit_NoneType(val): Promise<any>
visit_NoneType$({ val }): Promise<any>
visit_field_NameConstant_value(val): Promise<any>
visit_field_NameConstant_value$({ val }): Promise<any>
visit_field_Num_n(val): Promise<any>
visit_field_Num_n$({ val }): Promise<any>
ast_type_field
}
}
declare module gzip {
var _
/**
* Open a gzip-compressed file in binary or text mode.
*
* The filename argument can be an actual filename (a str or bytes object), or
* an existing file object to read from or write to.
*
* The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab" for
* binary mode, or "rt", "wt", "xt" or "at" for text mode. The default mode is
* "rb", and the default compresslevel is 9.
*
* For binary mode, this function is equivalent to the GzipFile constructor:
* GzipFile(filename, mode, compresslevel). In this case, the encoding, errors
* and newline arguments must not be provided.
*
* For text mode, a GzipFile object is created, and wrapped in an
* io.TextIOWrapper instance with the specified encoding, error handling
* behavior, and line ending(s).
*
*
*/
function open(filename, mode?, compresslevel?, encoding?, errors?, newline?): Promise<any>
function open$({ filename, mode, compresslevel, encoding, errors, newline }: { filename, mode?, compresslevel?, encoding?, errors?, newline?}): Promise<any>
function write32u(output, value): Promise<any>
function write32u$({ output, value }): Promise<any>
/**
* Compress data in one shot and return the compressed string.
* Optional argument is the compression level, in range of 0-9.
*
*/
function compress(data, compresslevel?): Promise<any>
function compress$({ data, compresslevel }: { data, compresslevel?}): Promise<any>
/**
* Decompress a gzip compressed string in one shot.
* Return the decompressed string.
*
*/
function decompress(data): Promise<any>
function decompress$({ data }): Promise<any>
function main(): Promise<any>
function main$($: {}): Promise<any>
/**
* Minimal read-only file object that prepends a string to the contents
* of an actual file. Shouldn't be used outside of gzip.py, as it lacks
* essential functionality.
*/
interface I_PaddedFile {
read(size): Promise<any>
read$({ size }): Promise<any>
prepend(prepend?): Promise<any>
prepend$({ prepend }: { prepend?}): Promise<any>
seek(off): Promise<any>
seek$({ off }): Promise<any>
seekable(): Promise<any>
seekable$($: {}): Promise<any>
}
/**
* Exception raised in some cases for invalid gzip files.
*/
interface IBadGzipFile {
}
/**
* The GzipFile class simulates most of the methods of a file object with
* the exception of the truncate() method.
*
* This class only supports opening files in binary mode. If you need to open a
* compressed file in text mode, use the gzip.open() function.
*
*
*/
/**
* Constructor for the GzipFile class.
*
* At least one of fileobj and filename must be given a
* non-trivial value.
*
* The new class instance is based on fileobj, which can be a regular
* file, an io.BytesIO object, or any other object which simulates a file.
* It defaults to None, in which case filename is opened to provide
* a file object.
*
* When fileobj is not None, the filename argument is only used to be
* included in the gzip file header, which may include the original
* filename of the uncompressed file. It defaults to the filename of
* fileobj, if discernible; otherwise, it defaults to the empty string,
* and in this case the original filename is not included in the header.
*
* The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', 'wb', 'x', or
* 'xb' depending on whether the file will be read or written. The default
* is the mode of fileobj if discernible; otherwise, the default is 'rb'.
* A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and
* 'wb', 'a' and 'ab', and 'x' and 'xb'.
*
* The compresslevel argument is an integer from 0 to 9 controlling the
* level of compression; 1 is fastest and produces the least compression,
* and 9 is slowest and produces the most compression. 0 is no compression
* at all. The default is 9.
*
* The mtime argument is an optional numeric timestamp to be written
* to the last modification time field in the stream when compressing.
* If omitted or None, the current time is used.
*
*
*/
function GzipFile(filename?, mode?, compresslevel?, fileobj?, mtime?): Promise<IGzipFile>
function GzipFile$({ filename, mode, compresslevel, fileobj, mtime }: { filename?, mode?, compresslevel?, fileobj?, mtime?}): Promise<IGzipFile>
interface IGzipFile {
filename(): Promise<any>
filename$($: {}): Promise<any>
/**
* Last modification time read from stream, or None
*/
mtime(): Promise<any>
mtime$($: {}): Promise<any>
write(data): Promise<any>
write$({ data }): Promise<any>
read(size?): Promise<any>
read$({ size }: { size?}): Promise<any>
/**
* Implements BufferedIOBase.read1()
*
* Reads up to a buffer's worth of data if size is negative.
*/
read1(size?): Promise<any>
read1$({ size }: { size?}): Promise<any>
peek(n): Promise<any>
peek$({ n }): Promise<any>
closed(): Promise<any>
closed$($: {}): Promise<any>
close(): Promise<any>
close$($: {}): Promise<any>
flush(zlib_mode?): Promise<any>
flush$({ zlib_mode }: { zlib_mode?}): Promise<any>
/**
* Invoke the underlying file obj