UNPKG

@wasm-fmt/ruff_fmt

Version:
92 lines (78 loc) 3.34 kB
/* tslint:disable */ /* eslint-disable */ /** * A range in text, using UTF-8 byte offsets. */ export interface TextRange { start: number; end: number; } /** * Result of formatting a range of code. */ export interface PrintedRange { code: string; source_range: TextRange; } interface LayoutConfig { /** Specifies the indent style: Either a tab or a specific amount of spaces */ indent_style?: "tab" | "space"; /** The visual width of a tab character */ indent_width?: number; /** The preferred line width at which the formatter should wrap lines */ line_width?: number; /** The type of line ending to apply to the printed input */ line_ending?: "lf" | "crlf"; } export interface Config extends LayoutConfig { /** The preferred quote style to use (single vs double quotes) */ quote_style?: "single" | "double" | "preserve"; /** Whether to expand lists or elements if they have a trailing comma */ magic_trailing_comma?: "respect" | "ignore"; /** Whether to format code snippets in docstrings or not */ docstring_code?: boolean; /** The preferred line width at which the formatter should wrap lines in docstring code examples */ docstring_code_line_width?: number | "dynamic"; /** Whether the formatter should generate a source map */ source_map_generation?: boolean; /** Whether preview style formatting is enabled or not */ preview?: boolean; } /** * Format the entire Python source code string. */ export function format(input: string, path?: string | null, config?: Config | null): string; /** * Format a specific range of the Python source code string. */ export function format_range(input: string, range: TextRange, path?: string | null, config?: Config | null): PrintedRange; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly format: (a: number, b: number, c: number, d: number, e: number, f: number) => void; readonly format_range: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void; readonly __wbindgen_export: (a: number, b: number) => number; readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_export3: (a: number) => void; readonly __wbindgen_add_to_stack_pointer: (a: number) => number; readonly __wbindgen_export4: (a: number, b: number, c: number) => void; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise<InitOutput>} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;