/** * Python sys module for TypeScript * * Provides access to system-specific parameters and functions. * This module provides variables and functions that interact with the * interpreter and its environment. * * @see {@link https://docs.python.org/3/library/sys.html | Python sys documentation} * @module */ /** * Command line arguments passed to the script. * Unlike Python, this excludes the Node.js executable and script path. * * @example * ```typescript * // node script.js arg1 arg2 * console.log(argv) // ["arg1", "arg2"] * ``` */ declare const argv: string[]; /** * A string identifying the platform (operating system). * * @example * ```typescript * console.log(platform) // "darwin", "linux", "win32", etc. * ``` */ declare const platform: string; /** * A string containing the version number of the Python interpreter (emulated). * Returns a custom version string for pythonlib. */ declare const version = "3.11.0 (pythonlib TypeScript implementation)"; /** * Version information as a named tuple-like object. * Contains major, minor, micro, releaselevel, and serial components. */ declare const versionInfo: { major: number; minor: number; micro: number; releaselevel: "final"; serial: number; 0: number; 1: number; 2: number; 3: "final"; 4: number; length: number; [Symbol.iterator]: () => Generator; }; /** * Path to the interpreter executable (Node.js executable path). * * @example * ```typescript * console.log(executable) // "/usr/local/bin/node" * ``` */ declare const executable: string; /** * A list of strings specifying the search path for modules. * In Node.js context, this returns module.paths or an empty array. */ declare const path: string[]; /** * Maximum value a variable of type Py_ssize_t can take. * Equivalent to Number.MAX_SAFE_INTEGER in JavaScript. */ declare const maxsize: number; /** * Standard input stream. */ declare const stdin: NodeJS.ReadStream | null; /** * Standard output stream. */ declare const stdout: NodeJS.WriteStream | null; /** * Standard error stream. */ declare const stderr: NodeJS.WriteStream | null; /** * Exit from Python (terminate the process). * * @param code - Optional exit status code (default: 0 for success) * @throws This function never returns; it terminates the process. * * @example * ```typescript * exit() // Exit with success * exit(1) // Exit with error code 1 * ``` */ declare function exit(code?: number): never; /** * Return the current recursion limit. * In JavaScript, this is effectively unlimited, but we return a reasonable default. */ declare function getRecursionLimit(): number; /** * Set the maximum depth of the Python interpreter stack. * This is a no-op in JavaScript as recursion is managed differently. * * @param limit - The new recursion limit */ declare function setRecursionLimit(limit: number): void; /** * Return the size of an object in bytes. * This is an approximation as JavaScript doesn't provide exact memory sizes. * * @param obj - Object to measure * @returns Approximate size in bytes */ declare function getSizeOf(obj: unknown): number; /** * Return the reference count for the object. * JavaScript uses garbage collection, so this always returns a placeholder value. * * @param _obj - Object to check * @returns Always returns 1 (reference counting not available in JS) */ declare function getRefCount(obj: unknown): number; /** * Return the default string encoding used by the Unicode implementation. */ declare function getDefaultEncoding(): string; /** * Return the name of the encoding used to convert filenames. */ declare function getFilesystemEncoding(): string; /** * Integer specifying the API version, in Node.js context returns 0. */ declare const apiVersion = 0; /** * A string giving the site-specific directory prefix. */ declare const prefix: string; /** * Byte order indicator: "little" or "big". */ declare const byteorder: "little" | "big"; /** * Float representation info (similar to Python's sys.float_info). */ declare const floatInfo: { max: number; maxExp: number; max10Exp: number; min: number; minExp: number; min10Exp: number; dig: number; mant_dig: number; epsilon: number; radix: number; rounds: number; }; /** * Integer representation info (similar to Python's sys.int_info). */ declare const intInfo: { bitsPerDigit: number; sizeofDigit: number; defaultMaxStrDigits: number; strDigitsCheckThreshold: number; }; /** * Hash implementation info. */ declare const hashInfo: { width: number; modulus: bigint; inf: number; nan: number; imag: number; algorithm: string; hashBits: number; seedBits: number; }; declare const sysModule_apiVersion: typeof apiVersion; declare const sysModule_argv: typeof argv; declare const sysModule_byteorder: typeof byteorder; declare const sysModule_executable: typeof executable; declare const sysModule_exit: typeof exit; declare const sysModule_floatInfo: typeof floatInfo; declare const sysModule_getDefaultEncoding: typeof getDefaultEncoding; declare const sysModule_getFilesystemEncoding: typeof getFilesystemEncoding; declare const sysModule_getRecursionLimit: typeof getRecursionLimit; declare const sysModule_getRefCount: typeof getRefCount; declare const sysModule_getSizeOf: typeof getSizeOf; declare const sysModule_hashInfo: typeof hashInfo; declare const sysModule_intInfo: typeof intInfo; declare const sysModule_maxsize: typeof maxsize; declare const sysModule_path: typeof path; declare const sysModule_platform: typeof platform; declare const sysModule_prefix: typeof prefix; declare const sysModule_setRecursionLimit: typeof setRecursionLimit; declare const sysModule_stderr: typeof stderr; declare const sysModule_stdin: typeof stdin; declare const sysModule_stdout: typeof stdout; declare const sysModule_version: typeof version; declare const sysModule_versionInfo: typeof versionInfo; declare namespace sysModule { export { sysModule_apiVersion as apiVersion, sysModule_argv as argv, sysModule_byteorder as byteorder, sysModule_executable as executable, sysModule_exit as exit, sysModule_floatInfo as floatInfo, sysModule_getDefaultEncoding as getDefaultEncoding, sysModule_getFilesystemEncoding as getFilesystemEncoding, sysModule_getRecursionLimit as getRecursionLimit, sysModule_getRefCount as getRefCount, sysModule_getSizeOf as getSizeOf, sysModule_hashInfo as hashInfo, sysModule_intInfo as intInfo, sysModule_maxsize as maxsize, sysModule_path as path, sysModule_platform as platform, sysModule_prefix as prefix, sysModule_setRecursionLimit as setRecursionLimit, sysModule_stderr as stderr, sysModule_stdin as stdin, sysModule_stdout as stdout, sysModule_version as version, sysModule_versionInfo as versionInfo }; } export { apiVersion as a, argv as b, byteorder as c, exit as d, executable as e, floatInfo as f, getDefaultEncoding as g, getFilesystemEncoding as h, getRecursionLimit as i, getRefCount as j, getSizeOf as k, hashInfo as l, intInfo as m, maxsize as n, platform as o, path as p, prefix as q, setRecursionLimit as r, sysModule as s, stderr as t, stdin as u, stdout as v, version as w, versionInfo as x };