|
| 1 | +import sys |
| 2 | +from _typeshed import SupportsWrite |
| 3 | +from collections.abc import Iterator |
| 4 | +from types import TracebackType |
| 5 | +from typing import Literal |
| 6 | +from typing_extensions import Self |
| 7 | + |
| 8 | +from . import formatting, sheet |
| 9 | +from .biffh import * |
| 10 | +from .formula import * |
| 11 | +from .timemachine import * |
| 12 | + |
| 13 | +empty_cell: sheet.Cell |
| 14 | +DEBUG: int |
| 15 | +MY_EOF: int |
| 16 | +SUPBOOK_UNK: int |
| 17 | +SUPBOOK_INTERNAL: int |
| 18 | +SUPBOOK_EXTERNAL: int |
| 19 | +SUPBOOK_ADDIN: int |
| 20 | +SUPBOOK_DDEOLE: int |
| 21 | +SUPPORTED_VERSIONS: tuple[int, ...] |
| 22 | +builtin_name_from_code: dict[str, str] |
| 23 | +code_from_builtin_name: dict[str, str] |
| 24 | + |
| 25 | +def open_workbook_xls( |
| 26 | + filename: str | None = None, |
| 27 | + logfile: SupportsWrite[str] = sys.stdout, |
| 28 | + verbosity: int = 0, |
| 29 | + use_mmap: bool = True, |
| 30 | + file_contents: bytes | None = None, |
| 31 | + encoding_override: str | None = None, |
| 32 | + formatting_info: bool = False, |
| 33 | + on_demand: bool = False, |
| 34 | + ragged_rows: bool = False, |
| 35 | + ignore_workbook_corruption: bool = False, |
| 36 | +) -> Book: ... |
| 37 | + |
| 38 | +class Name(BaseObject): |
| 39 | + _repr_these: list[str] |
| 40 | + book: Book | None = None |
| 41 | + hidden: Literal[0, 1] |
| 42 | + func: Literal[0, 1] |
| 43 | + vbasic: Literal[0, 1] |
| 44 | + macro: Literal[0, 1] |
| 45 | + complex: Literal[0, 1] |
| 46 | + builtin: Literal[0, 1] |
| 47 | + funcgroup: Literal[0, 1] |
| 48 | + binary: Literal[0, 1] |
| 49 | + name_index: int |
| 50 | + name: str |
| 51 | + raw_formula: bytes |
| 52 | + scope: Literal[-1, -2, -3, 0] |
| 53 | + result: Operand | None |
| 54 | + def cell(self) -> sheet.Cell: ... |
| 55 | + def area2d(self, clipped: bool = True) -> tuple[sheet.Sheet, int, int, int, int]: ... |
| 56 | + |
| 57 | +class Book(BaseObject): |
| 58 | + nsheets: int |
| 59 | + datemode: Literal[0, 1] |
| 60 | + biff_version: int |
| 61 | + name_obj_list: list[Name] |
| 62 | + codepage: int | None |
| 63 | + encoding: str | None |
| 64 | + countries: tuple[int, int] |
| 65 | + user_name: str |
| 66 | + font_list: list[formatting.Font] |
| 67 | + xf_list: list[formatting.XF] |
| 68 | + format_list: list[formatting.Format] |
| 69 | + format_map: dict[int, formatting.Format] |
| 70 | + style_name_map: dict[str, tuple[int, int]] |
| 71 | + colour_map: dict[int, tuple[int, int, int] | None] |
| 72 | + palette_record: list[tuple[int, int, int]] |
| 73 | + load_time_stage_1: float |
| 74 | + load_time_stage_2: float |
| 75 | + def sheets(self) -> list[sheet.Sheet]: ... |
| 76 | + def sheet_by_index(self, sheetx: int) -> sheet.Sheet: ... |
| 77 | + def __iter__(self) -> Iterator[sheet.Sheet]: ... |
| 78 | + def sheet_by_name(self, sheet_name: str) -> sheet.Sheet: ... |
| 79 | + def __getitem__(self, item: int | str) -> sheet.Sheet: ... |
| 80 | + def sheet_names(self) -> list[str]: ... |
| 81 | + def sheet_loaded(self, sheet_name_or_index: int | str) -> bool: ... |
| 82 | + def unload_sheet(self, sheet_name_or_index: int | str) -> None: ... |
| 83 | + mem: bytes | None = None |
| 84 | + filestr: bytes | None = None |
| 85 | + def release_resources(self) -> None: ... |
| 86 | + def __enter__(self) -> Self: ... |
| 87 | + def __exit__( |
| 88 | + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None |
| 89 | + ) -> None: ... |
| 90 | + name_and_scope_map: dict[tuple[str, int], Name] |
| 91 | + name_map: dict[str, list[Name]] |
| 92 | + raw_user_name: bool |
| 93 | + builtinfmtcount: int |
| 94 | + addin_func_names: list[str] |
| 95 | + def __init__(self) -> None: ... |
| 96 | + logfile: SupportsWrite[str] |
| 97 | + verbosity: int |
| 98 | + use_mmap: bool |
| 99 | + encoding_override: str | None |
| 100 | + formatting_info: bool |
| 101 | + on_demand: bool |
| 102 | + ragged_rows: bool |
| 103 | + stream_len: int |
| 104 | + base: int |
| 105 | + def biff2_8_load( |
| 106 | + self, |
| 107 | + filename: str | None = None, |
| 108 | + file_contents: bytes | None = None, |
| 109 | + logfile: SupportsWrite[str] = sys.stdout, |
| 110 | + verbosity: int = 0, |
| 111 | + use_mmap: bool = True, |
| 112 | + encoding_override: str | None = None, |
| 113 | + formatting_info: bool = False, |
| 114 | + on_demand: bool = False, |
| 115 | + ragged_rows: bool = False, |
| 116 | + ignore_workbook_corruption: bool = False, |
| 117 | + ) -> None: ... |
| 118 | + xfcount: int |
| 119 | + actualfmtcount: int |
| 120 | + def initialise_format_info(self) -> None: ... |
| 121 | + def get2bytes(self) -> int: ... |
| 122 | + def get_record_parts(self) -> tuple[int, int, bytes]: ... |
| 123 | + def get_record_parts_conditional(self, reqd_record: int) -> tuple[int | None, int, bytes]: ... |
| 124 | + def get_sheet(self, sh_number: int, update_pos: bool = True) -> sheet.Sheet: ... |
| 125 | + def get_sheets(self) -> None: ... |
| 126 | + def fake_globals_get_sheet(self) -> None: ... |
| 127 | + def handle_boundsheet(self, data: bytes) -> None: ... |
| 128 | + def handle_builtinfmtcount(self, data: bytes) -> None: ... |
| 129 | + def derive_encoding(self) -> str: ... |
| 130 | + def handle_codepage(self, data: bytes) -> None: ... |
| 131 | + def handle_country(self, data: bytes) -> None: ... |
| 132 | + def handle_datemode(self, data: bytes) -> None: ... |
| 133 | + def handle_externname(self, data: bytes) -> None: ... |
| 134 | + def handle_externsheet(self, data: bytes) -> None: ... |
| 135 | + def handle_filepass(self, data: bytes) -> None: ... |
| 136 | + def handle_name(self, data: bytes) -> None: ... |
| 137 | + def names_epilogue(self) -> None: ... |
| 138 | + def handle_obj(self, data: bytes) -> None: ... |
| 139 | + def handle_supbook(self, data: bytes) -> None: ... |
| 140 | + def handle_sheethdr(self, data: bytes) -> None: ... |
| 141 | + def handle_sheetsoffset(self, data: bytes) -> None: ... |
| 142 | + def handle_sst(self, data) -> None: ... |
| 143 | + def handle_writeaccess(self, data) -> None: ... |
| 144 | + def parse_globals(self) -> None: ... |
| 145 | + def read(self, pos: int, length: int) -> bytes: ... |
| 146 | + def getbof(self, rqd_stream: int) -> int | None: ... |
| 147 | + |
| 148 | +# Helper functions |
| 149 | +def expand_cell_address(inrow: int, incol: int) -> tuple[int, int, int, int]: ... |
| 150 | +def colname(colx: int) -> str: ... |
| 151 | +def display_cell_address(rowx: int, colx: int, relrow: int, relcol: int) -> str: ... |
| 152 | +def unpack_SST_table(datatab: list[bytes], nstrings: int) -> tuple[list[str], dict[int, list[tuple[int, int]]]]: ... |
0 commit comments