rowsncolumns-spreadsheet 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rowsncolumns_spreadsheet-0.1.0/PKG-INFO +196 -0
- rowsncolumns_spreadsheet-0.1.0/README.md +177 -0
- rowsncolumns_spreadsheet-0.1.0/pyproject.toml +34 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/__init__.py +106 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/datatype.py +760 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/efficient_interface.py +423 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/efficient_patches.py +434 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/immer_interface.py +449 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/immer_like_patches.py +364 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/interface.py +376 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/operations.py +373 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/patches.py +305 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/sheet_cell.py +1922 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/sheet_cell_helpers.py +255 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/spreadsheet.py +309 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/types.py +191 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet/utils.py +180 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet.egg-info/PKG-INFO +196 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet.egg-info/SOURCES.txt +25 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet.egg-info/dependency_links.txt +1 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet.egg-info/requires.txt +9 -0
- rowsncolumns_spreadsheet-0.1.0/rowsncolumns_spreadsheet.egg-info/top_level.txt +2 -0
- rowsncolumns_spreadsheet-0.1.0/setup.cfg +4 -0
- rowsncolumns_spreadsheet-0.1.0/setup.py +22 -0
- rowsncolumns_spreadsheet-0.1.0/tests/__init__.py +1 -0
- rowsncolumns_spreadsheet-0.1.0/tests/test_insert_row.py +258 -0
- rowsncolumns_spreadsheet-0.1.0/tests/test_sheet_cell.py +591 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rowsncolumns-spreadsheet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python implementation of rowsncolumns spreadsheet operations
|
|
5
|
+
Author: Rows & Columns
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: pydantic>=2.0.0
|
|
10
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
11
|
+
Requires-Dist: jsonpatch>=1.33
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
14
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
15
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
16
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: requires-python
|
|
19
|
+
|
|
20
|
+
# Rows & Columns Spreadsheet - Python Library
|
|
21
|
+
|
|
22
|
+
A Python implementation of spreadsheet operations, providing data manipulation capabilities similar to the TypeScript version used in the main Rows & Columns spreadsheet application.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **Core Data Types**: Pydantic models for sheets, cells, ranges, and selections
|
|
27
|
+
- **Row Operations**: Insert and delete rows with proper data shifting
|
|
28
|
+
- **Column Operations**: Insert and delete columns with proper data shifting
|
|
29
|
+
- **Cell Operations**: Get and set cell values, work with ranges
|
|
30
|
+
- **Table Support**: Automatic table range updates during row/column operations
|
|
31
|
+
- **Filter Support**: Basic filter range updates
|
|
32
|
+
- **Merge Support**: Merged cell range updates
|
|
33
|
+
- **History**: Operation history for undo/redo functionality
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd python
|
|
39
|
+
pip install -e .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For development:
|
|
43
|
+
```bash
|
|
44
|
+
pip install -e ".[dev]"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from rowsncolumns_spreadsheet import Spreadsheet, GridRange
|
|
51
|
+
|
|
52
|
+
# Create a new spreadsheet
|
|
53
|
+
spreadsheet = Spreadsheet()
|
|
54
|
+
|
|
55
|
+
# Set some cell values
|
|
56
|
+
spreadsheet.set_cell_value(0, 0, 0, "Hello") # Sheet 0, Row 0, Col 0
|
|
57
|
+
spreadsheet.set_cell_value(0, 0, 1, "World") # Sheet 0, Row 0, Col 1
|
|
58
|
+
|
|
59
|
+
# Get cell values
|
|
60
|
+
value = spreadsheet.get_cell_value(0, 0, 0) # Returns "Hello"
|
|
61
|
+
|
|
62
|
+
# Insert rows
|
|
63
|
+
spreadsheet.insert_rows(sheet_id=0, reference_row_index=1, num_rows=2)
|
|
64
|
+
|
|
65
|
+
# Insert columns
|
|
66
|
+
spreadsheet.insert_columns(sheet_id=0, reference_column_index=1, num_columns=1)
|
|
67
|
+
|
|
68
|
+
# Work with ranges
|
|
69
|
+
range_values = spreadsheet.get_range_values(
|
|
70
|
+
sheet_id=0,
|
|
71
|
+
range_spec=GridRange(
|
|
72
|
+
start_row_index=0,
|
|
73
|
+
end_row_index=2,
|
|
74
|
+
start_column_index=0,
|
|
75
|
+
end_column_index=2,
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Set range values
|
|
80
|
+
spreadsheet.set_range_values(
|
|
81
|
+
sheet_id=0,
|
|
82
|
+
range_spec=GridRange(start_row_index=0, end_row_index=1, start_column_index=0, end_column_index=1),
|
|
83
|
+
values=[["A1", "B1"], ["A2", "B2"]]
|
|
84
|
+
)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Architecture
|
|
88
|
+
|
|
89
|
+
The library is structured around these core concepts:
|
|
90
|
+
|
|
91
|
+
### Data Types (`types.py`)
|
|
92
|
+
- **CellData**: Individual cell with value, formula, and formatting
|
|
93
|
+
- **GridRange**: Rectangular cell range specification
|
|
94
|
+
- **Sheet**: Worksheet with metadata, dimensions, and features
|
|
95
|
+
- **SpreadsheetState**: Complete spreadsheet state including all sheets and data
|
|
96
|
+
|
|
97
|
+
### Operations (`operations.py`)
|
|
98
|
+
- **insert_row()**: Insert rows with proper data shifting and metadata updates
|
|
99
|
+
- **delete_row()**: Delete rows with proper cleanup
|
|
100
|
+
- **insert_column()**: Insert columns with proper data shifting
|
|
101
|
+
- **delete_column()**: Delete columns with proper cleanup
|
|
102
|
+
|
|
103
|
+
### High-Level Interface (`spreadsheet.py`)
|
|
104
|
+
- **Spreadsheet**: Main class providing convenient methods for common operations
|
|
105
|
+
- Manages state internally and provides intuitive APIs
|
|
106
|
+
|
|
107
|
+
### Utilities (`utils.py`)
|
|
108
|
+
- Helper functions for moving ranges, cloning formatting, etc.
|
|
109
|
+
|
|
110
|
+
## Compatibility with TypeScript Version
|
|
111
|
+
|
|
112
|
+
This Python implementation mirrors the core functionality of the TypeScript version:
|
|
113
|
+
|
|
114
|
+
1. **Data Structures**: Similar models using Pydantic instead of TypeScript interfaces
|
|
115
|
+
2. **Operation Logic**: Same algorithms for row/column insertion with proper shifting
|
|
116
|
+
3. **Metadata Handling**: Proper updates to tables, filters, merges, and frozen areas
|
|
117
|
+
4. **History Support**: Operation tracking for undo/redo functionality
|
|
118
|
+
|
|
119
|
+
Key differences:
|
|
120
|
+
- Uses Python/Pydantic conventions (snake_case, etc.)
|
|
121
|
+
- Simplified callback system (no React-specific patterns)
|
|
122
|
+
- Immutable state updates using model copying instead of Immer
|
|
123
|
+
|
|
124
|
+
## Testing
|
|
125
|
+
|
|
126
|
+
Run tests with pytest:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pytest tests/
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Run with coverage:
|
|
133
|
+
```bash
|
|
134
|
+
pytest --cov=rowsncolumns_spreadsheet tests/
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Development
|
|
138
|
+
|
|
139
|
+
Format code:
|
|
140
|
+
```bash
|
|
141
|
+
black rowsncolumns_spreadsheet/ tests/
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Type checking:
|
|
145
|
+
```bash
|
|
146
|
+
mypy rowsncolumns_spreadsheet/
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Example: Advanced Usage
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from rowsncolumns_spreadsheet import (
|
|
153
|
+
Spreadsheet,
|
|
154
|
+
Sheet,
|
|
155
|
+
GridRange,
|
|
156
|
+
Table,
|
|
157
|
+
FilterView,
|
|
158
|
+
MergedCell
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
# Create a spreadsheet with custom configuration
|
|
162
|
+
custom_sheet = Sheet(
|
|
163
|
+
sheet_id=1,
|
|
164
|
+
name="Sales Data",
|
|
165
|
+
index=0,
|
|
166
|
+
row_count=5000,
|
|
167
|
+
column_count=50,
|
|
168
|
+
frozen_row_count=1, # Freeze header row
|
|
169
|
+
frozen_column_count=2, # Freeze first two columns
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
spreadsheet = Spreadsheet()
|
|
173
|
+
spreadsheet._state.sheets.append(custom_sheet)
|
|
174
|
+
|
|
175
|
+
# Add a table
|
|
176
|
+
table = Table(
|
|
177
|
+
sheet_id=1,
|
|
178
|
+
range=GridRange(
|
|
179
|
+
start_row_index=0,
|
|
180
|
+
end_row_index=100,
|
|
181
|
+
start_column_index=0,
|
|
182
|
+
end_column_index=10,
|
|
183
|
+
),
|
|
184
|
+
name="SalesTable"
|
|
185
|
+
)
|
|
186
|
+
spreadsheet._state.tables.append(table)
|
|
187
|
+
|
|
188
|
+
# Insert rows - table will automatically expand
|
|
189
|
+
spreadsheet.insert_rows(sheet_id=1, reference_row_index=50, num_rows=10)
|
|
190
|
+
|
|
191
|
+
# The table range will now include the new rows
|
|
192
|
+
updated_table = spreadsheet._state.tables[0]
|
|
193
|
+
print(f"Table now spans rows {updated_table.range.start_row_index}-{updated_table.range.end_row_index}")
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
This Python library provides a solid foundation for building spreadsheet applications or integrating spreadsheet functionality into Python applications, while maintaining compatibility with the existing TypeScript ecosystem.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Rows & Columns Spreadsheet - Python Library
|
|
2
|
+
|
|
3
|
+
A Python implementation of spreadsheet operations, providing data manipulation capabilities similar to the TypeScript version used in the main Rows & Columns spreadsheet application.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Core Data Types**: Pydantic models for sheets, cells, ranges, and selections
|
|
8
|
+
- **Row Operations**: Insert and delete rows with proper data shifting
|
|
9
|
+
- **Column Operations**: Insert and delete columns with proper data shifting
|
|
10
|
+
- **Cell Operations**: Get and set cell values, work with ranges
|
|
11
|
+
- **Table Support**: Automatic table range updates during row/column operations
|
|
12
|
+
- **Filter Support**: Basic filter range updates
|
|
13
|
+
- **Merge Support**: Merged cell range updates
|
|
14
|
+
- **History**: Operation history for undo/redo functionality
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cd python
|
|
20
|
+
pip install -e .
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For development:
|
|
24
|
+
```bash
|
|
25
|
+
pip install -e ".[dev]"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from rowsncolumns_spreadsheet import Spreadsheet, GridRange
|
|
32
|
+
|
|
33
|
+
# Create a new spreadsheet
|
|
34
|
+
spreadsheet = Spreadsheet()
|
|
35
|
+
|
|
36
|
+
# Set some cell values
|
|
37
|
+
spreadsheet.set_cell_value(0, 0, 0, "Hello") # Sheet 0, Row 0, Col 0
|
|
38
|
+
spreadsheet.set_cell_value(0, 0, 1, "World") # Sheet 0, Row 0, Col 1
|
|
39
|
+
|
|
40
|
+
# Get cell values
|
|
41
|
+
value = spreadsheet.get_cell_value(0, 0, 0) # Returns "Hello"
|
|
42
|
+
|
|
43
|
+
# Insert rows
|
|
44
|
+
spreadsheet.insert_rows(sheet_id=0, reference_row_index=1, num_rows=2)
|
|
45
|
+
|
|
46
|
+
# Insert columns
|
|
47
|
+
spreadsheet.insert_columns(sheet_id=0, reference_column_index=1, num_columns=1)
|
|
48
|
+
|
|
49
|
+
# Work with ranges
|
|
50
|
+
range_values = spreadsheet.get_range_values(
|
|
51
|
+
sheet_id=0,
|
|
52
|
+
range_spec=GridRange(
|
|
53
|
+
start_row_index=0,
|
|
54
|
+
end_row_index=2,
|
|
55
|
+
start_column_index=0,
|
|
56
|
+
end_column_index=2,
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
# Set range values
|
|
61
|
+
spreadsheet.set_range_values(
|
|
62
|
+
sheet_id=0,
|
|
63
|
+
range_spec=GridRange(start_row_index=0, end_row_index=1, start_column_index=0, end_column_index=1),
|
|
64
|
+
values=[["A1", "B1"], ["A2", "B2"]]
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Architecture
|
|
69
|
+
|
|
70
|
+
The library is structured around these core concepts:
|
|
71
|
+
|
|
72
|
+
### Data Types (`types.py`)
|
|
73
|
+
- **CellData**: Individual cell with value, formula, and formatting
|
|
74
|
+
- **GridRange**: Rectangular cell range specification
|
|
75
|
+
- **Sheet**: Worksheet with metadata, dimensions, and features
|
|
76
|
+
- **SpreadsheetState**: Complete spreadsheet state including all sheets and data
|
|
77
|
+
|
|
78
|
+
### Operations (`operations.py`)
|
|
79
|
+
- **insert_row()**: Insert rows with proper data shifting and metadata updates
|
|
80
|
+
- **delete_row()**: Delete rows with proper cleanup
|
|
81
|
+
- **insert_column()**: Insert columns with proper data shifting
|
|
82
|
+
- **delete_column()**: Delete columns with proper cleanup
|
|
83
|
+
|
|
84
|
+
### High-Level Interface (`spreadsheet.py`)
|
|
85
|
+
- **Spreadsheet**: Main class providing convenient methods for common operations
|
|
86
|
+
- Manages state internally and provides intuitive APIs
|
|
87
|
+
|
|
88
|
+
### Utilities (`utils.py`)
|
|
89
|
+
- Helper functions for moving ranges, cloning formatting, etc.
|
|
90
|
+
|
|
91
|
+
## Compatibility with TypeScript Version
|
|
92
|
+
|
|
93
|
+
This Python implementation mirrors the core functionality of the TypeScript version:
|
|
94
|
+
|
|
95
|
+
1. **Data Structures**: Similar models using Pydantic instead of TypeScript interfaces
|
|
96
|
+
2. **Operation Logic**: Same algorithms for row/column insertion with proper shifting
|
|
97
|
+
3. **Metadata Handling**: Proper updates to tables, filters, merges, and frozen areas
|
|
98
|
+
4. **History Support**: Operation tracking for undo/redo functionality
|
|
99
|
+
|
|
100
|
+
Key differences:
|
|
101
|
+
- Uses Python/Pydantic conventions (snake_case, etc.)
|
|
102
|
+
- Simplified callback system (no React-specific patterns)
|
|
103
|
+
- Immutable state updates using model copying instead of Immer
|
|
104
|
+
|
|
105
|
+
## Testing
|
|
106
|
+
|
|
107
|
+
Run tests with pytest:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pytest tests/
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Run with coverage:
|
|
114
|
+
```bash
|
|
115
|
+
pytest --cov=rowsncolumns_spreadsheet tests/
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Development
|
|
119
|
+
|
|
120
|
+
Format code:
|
|
121
|
+
```bash
|
|
122
|
+
black rowsncolumns_spreadsheet/ tests/
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Type checking:
|
|
126
|
+
```bash
|
|
127
|
+
mypy rowsncolumns_spreadsheet/
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Example: Advanced Usage
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from rowsncolumns_spreadsheet import (
|
|
134
|
+
Spreadsheet,
|
|
135
|
+
Sheet,
|
|
136
|
+
GridRange,
|
|
137
|
+
Table,
|
|
138
|
+
FilterView,
|
|
139
|
+
MergedCell
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
# Create a spreadsheet with custom configuration
|
|
143
|
+
custom_sheet = Sheet(
|
|
144
|
+
sheet_id=1,
|
|
145
|
+
name="Sales Data",
|
|
146
|
+
index=0,
|
|
147
|
+
row_count=5000,
|
|
148
|
+
column_count=50,
|
|
149
|
+
frozen_row_count=1, # Freeze header row
|
|
150
|
+
frozen_column_count=2, # Freeze first two columns
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
spreadsheet = Spreadsheet()
|
|
154
|
+
spreadsheet._state.sheets.append(custom_sheet)
|
|
155
|
+
|
|
156
|
+
# Add a table
|
|
157
|
+
table = Table(
|
|
158
|
+
sheet_id=1,
|
|
159
|
+
range=GridRange(
|
|
160
|
+
start_row_index=0,
|
|
161
|
+
end_row_index=100,
|
|
162
|
+
start_column_index=0,
|
|
163
|
+
end_column_index=10,
|
|
164
|
+
),
|
|
165
|
+
name="SalesTable"
|
|
166
|
+
)
|
|
167
|
+
spreadsheet._state.tables.append(table)
|
|
168
|
+
|
|
169
|
+
# Insert rows - table will automatically expand
|
|
170
|
+
spreadsheet.insert_rows(sheet_id=1, reference_row_index=50, num_rows=10)
|
|
171
|
+
|
|
172
|
+
# The table range will now include the new rows
|
|
173
|
+
updated_table = spreadsheet._state.tables[0]
|
|
174
|
+
print(f"Table now spans rows {updated_table.range.start_row_index}-{updated_table.range.end_row_index}")
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
This Python library provides a solid foundation for building spreadsheet applications or integrating spreadsheet functionality into Python applications, while maintaining compatibility with the existing TypeScript ecosystem.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "rowsncolumns-spreadsheet"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python implementation of rowsncolumns spreadsheet operations"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"pydantic>=2.0.0",
|
|
14
|
+
"typing-extensions>=4.0.0",
|
|
15
|
+
"jsonpatch>=1.33",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.optional-dependencies]
|
|
19
|
+
dev = [
|
|
20
|
+
"pytest>=7.0.0",
|
|
21
|
+
"pytest-cov>=4.0.0",
|
|
22
|
+
"black>=23.0.0",
|
|
23
|
+
"mypy>=1.0.0",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[tool.black]
|
|
27
|
+
line-length = 88
|
|
28
|
+
target-version = ['py38']
|
|
29
|
+
|
|
30
|
+
[tool.mypy]
|
|
31
|
+
python_version = "3.8"
|
|
32
|
+
warn_return_any = true
|
|
33
|
+
warn_unused_configs = true
|
|
34
|
+
disallow_untyped_defs = true
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Rows & Columns Spreadsheet - Python Implementation
|
|
3
|
+
|
|
4
|
+
A Python library for spreadsheet operations, providing data manipulation
|
|
5
|
+
capabilities similar to the TypeScript version.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .types import (
|
|
9
|
+
CellData,
|
|
10
|
+
GridRange,
|
|
11
|
+
SelectionArea,
|
|
12
|
+
Sheet,
|
|
13
|
+
CellInterface,
|
|
14
|
+
Direction,
|
|
15
|
+
SpreadsheetState,
|
|
16
|
+
ExtendedValue,
|
|
17
|
+
ErrorValue,
|
|
18
|
+
)
|
|
19
|
+
from .spreadsheet import Spreadsheet
|
|
20
|
+
from .operations import insert_row, delete_row, insert_column, delete_column
|
|
21
|
+
from .interface import SpreadsheetInterface
|
|
22
|
+
from .immer_interface import ImmerSpreadsheetInterface, produce_with_patches, apply_patches
|
|
23
|
+
from .patches import SpreadsheetPatch, JSONPatch, PatchGenerator
|
|
24
|
+
from .sheet_cell import SheetCell, DEFAULT_SHEET_ID, DEFAULT_CELL_COORDS
|
|
25
|
+
from .sheet_cell_helpers import (
|
|
26
|
+
create_row_data_from_array,
|
|
27
|
+
is_cell_range,
|
|
28
|
+
combine_map_iterators,
|
|
29
|
+
get_next_table_column_name,
|
|
30
|
+
get_conflicting_table,
|
|
31
|
+
hash_object,
|
|
32
|
+
AWAITING_CALCULATION,
|
|
33
|
+
)
|
|
34
|
+
from .datatype import (
|
|
35
|
+
detect_value_type_and_pattern,
|
|
36
|
+
detect_value_type,
|
|
37
|
+
detect_number_format_type,
|
|
38
|
+
detect_number_format_pattern,
|
|
39
|
+
detect_decimal_pattern,
|
|
40
|
+
is_currency,
|
|
41
|
+
is_boolean,
|
|
42
|
+
is_percentage,
|
|
43
|
+
is_number,
|
|
44
|
+
is_formula,
|
|
45
|
+
is_valid_url_or_email,
|
|
46
|
+
is_multiline,
|
|
47
|
+
convert_to_number,
|
|
48
|
+
create_formatted_value,
|
|
49
|
+
PATTERN_NUMBER,
|
|
50
|
+
PATTERN_NUMBER_THOUSANDS,
|
|
51
|
+
PATTERN_PERCENT,
|
|
52
|
+
PATTERN_CURRENCY,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
__version__ = "0.1.0"
|
|
56
|
+
__all__ = [
|
|
57
|
+
"CellData",
|
|
58
|
+
"GridRange",
|
|
59
|
+
"SelectionArea",
|
|
60
|
+
"Sheet",
|
|
61
|
+
"CellInterface",
|
|
62
|
+
"Direction",
|
|
63
|
+
"SpreadsheetState",
|
|
64
|
+
"ExtendedValue",
|
|
65
|
+
"ErrorValue",
|
|
66
|
+
"Spreadsheet",
|
|
67
|
+
"SpreadsheetInterface",
|
|
68
|
+
"ImmerSpreadsheetInterface",
|
|
69
|
+
"produce_with_patches",
|
|
70
|
+
"apply_patches",
|
|
71
|
+
"SpreadsheetPatch",
|
|
72
|
+
"JSONPatch",
|
|
73
|
+
"PatchGenerator",
|
|
74
|
+
"insert_row",
|
|
75
|
+
"delete_row",
|
|
76
|
+
"insert_column",
|
|
77
|
+
"delete_column",
|
|
78
|
+
"SheetCell",
|
|
79
|
+
"DEFAULT_SHEET_ID",
|
|
80
|
+
"DEFAULT_CELL_COORDS",
|
|
81
|
+
"create_row_data_from_array",
|
|
82
|
+
"is_cell_range",
|
|
83
|
+
"combine_map_iterators",
|
|
84
|
+
"get_next_table_column_name",
|
|
85
|
+
"get_conflicting_table",
|
|
86
|
+
"hash_object",
|
|
87
|
+
"AWAITING_CALCULATION",
|
|
88
|
+
"detect_value_type_and_pattern",
|
|
89
|
+
"detect_value_type",
|
|
90
|
+
"detect_number_format_type",
|
|
91
|
+
"detect_number_format_pattern",
|
|
92
|
+
"detect_decimal_pattern",
|
|
93
|
+
"is_currency",
|
|
94
|
+
"is_boolean",
|
|
95
|
+
"is_percentage",
|
|
96
|
+
"is_number",
|
|
97
|
+
"is_formula",
|
|
98
|
+
"is_valid_url_or_email",
|
|
99
|
+
"is_multiline",
|
|
100
|
+
"convert_to_number",
|
|
101
|
+
"create_formatted_value",
|
|
102
|
+
"PATTERN_NUMBER",
|
|
103
|
+
"PATTERN_NUMBER_THOUSANDS",
|
|
104
|
+
"PATTERN_PERCENT",
|
|
105
|
+
"PATTERN_CURRENCY",
|
|
106
|
+
]
|