-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path_python_calamine.pyi
More file actions
84 lines (72 loc) · 2.35 KB
/
_python_calamine.pyi
File metadata and controls
84 lines (72 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from __future__ import annotations
from datetime import date, datetime, time
from os import PathLike
from typing import Protocol
ValueT = int | float | str | bool | time | date | datetime
class ReadBuffer(Protocol):
def seek(self) -> int: ...
def read(self) -> bytes: ...
class CalamineSheet:
name: str
@property
def height(self) -> int: ...
@property
def width(self) -> int: ...
@property
def total_height(self) -> int: ...
@property
def total_width(self) -> int: ...
@property
def start(self) -> tuple[int, int] | None: ...
@property
def end(self) -> tuple[int, int] | None: ...
def to_python(self, skip_empty_area: bool = True) -> list[list[ValueT]]:
"""Retunrning data from sheet as list of lists.
Parameters
----------
skip_empty_area : bool
By default, calamine skips empty rows/cols before data.
For suppress this behaviour, set `skip_empty_area` to `False`.
"""
class CalamineWorkbook:
sheet_names: list[str]
@classmethod
def from_object(
cls, path_or_filelike: str | PathLike | ReadBuffer
) -> "CalamineWorkbook":
"""Determining type of pyobject and reading from it.
Parameters
----------
path_or_filelike :
- path (string),
- pathlike (pathlib.Path),
- IO (must imlpement read/seek methods).
"""
@classmethod
def from_path(cls, path: str) -> "CalamineWorkbook":
"""Reading file from path.
Parameters
----------
path : path (string)."""
@classmethod
def from_filelike(cls, filelike: ReadBuffer) -> "CalamineWorkbook":
"""Reading file from IO.
Parameters
----------
filelike : IO (must imlpement read/seek methods).
"""
def get_sheet_by_name(self, name: str) -> CalamineSheet: ...
def get_sheet_by_index(self, index: int) -> CalamineSheet: ...
def pictures(self) -> list[tuple[str, bytes]] | None: ...
class CalamineError(Exception): ...
def load_workbook(
path_or_filelike: str | PathLike | ReadBuffer,
) -> CalamineWorkbook:
"""Determining type of pyobject and reading from it.
Parameters
----------
path_or_filelike :
- path (string),
- pathlike (pathlib.Path),
- IO (must imlpement read/seek methods).
"""