smartsheet-tools 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl
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.
- smartsheet_tools/__init__.py +56 -0
- {smartsheet_tools-0.0.1.dist-info → smartsheet_tools-0.0.2.dist-info}/METADATA +1 -1
- smartsheet_tools-0.0.2.dist-info/RECORD +6 -0
- smartsheet_tools-0.0.2.dist-info/top_level.txt +1 -0
- smartsheet_tools-0.0.1.dist-info/RECORD +0 -5
- smartsheet_tools-0.0.1.dist-info/top_level.txt +0 -1
- {smartsheet_tools-0.0.1.dist-info → smartsheet_tools-0.0.2.dist-info}/WHEEL +0 -0
- {smartsheet_tools-0.0.1.dist-info → smartsheet_tools-0.0.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from smartsheet.models import Cell, Row
|
|
3
|
+
|
|
4
|
+
def norm(v):
|
|
5
|
+
if v is None:
|
|
6
|
+
return ""
|
|
7
|
+
s = str(v).strip().lower()
|
|
8
|
+
return re.sub(r"\.0+$", "", s)
|
|
9
|
+
|
|
10
|
+
def disp_or_val(cell):
|
|
11
|
+
# prefer display_value when Smartsheet provides a formatted value
|
|
12
|
+
dv = getattr(cell, "display_value", None)
|
|
13
|
+
return dv if dv not in (None, "") else cell.value
|
|
14
|
+
|
|
15
|
+
def title_to_index(sheet):
|
|
16
|
+
# authoritative positions from Smartsheet (not Python enumerate order)
|
|
17
|
+
return {c.title: c.index for c in sheet.columns}
|
|
18
|
+
|
|
19
|
+
def index_to_id(sheet):
|
|
20
|
+
# authoritative positions from Smartsheet (not Python enumerate order)
|
|
21
|
+
return {c.index: c.id for c in sheet.columns}
|
|
22
|
+
|
|
23
|
+
def id_to_index(sheet):
|
|
24
|
+
# authoritative positions from Smartsheet (not Python enumerate order)
|
|
25
|
+
return {c.id: c.index for c in sheet.columns}
|
|
26
|
+
|
|
27
|
+
def id_to_title(sheet):
|
|
28
|
+
return {c.id: c.title for c in sheet.columns}
|
|
29
|
+
|
|
30
|
+
def title_to_id(sheet):
|
|
31
|
+
return {c.title: c.id for c in sheet.columns}
|
|
32
|
+
|
|
33
|
+
def guard_row(row, *idxs):
|
|
34
|
+
# ensure row has enough cells for all requested positions
|
|
35
|
+
return max(idxs) < len(row.cells)
|
|
36
|
+
|
|
37
|
+
def new_cell(column_id, value=None, strict=False, formula=None):
|
|
38
|
+
new_cell = Cell()
|
|
39
|
+
new_cell.column_id = column_id
|
|
40
|
+
if formula is not None:
|
|
41
|
+
new_cell.formula = formula
|
|
42
|
+
else:
|
|
43
|
+
new_cell.value = value
|
|
44
|
+
if strict:
|
|
45
|
+
new_cell.strict = True
|
|
46
|
+
return new_cell
|
|
47
|
+
|
|
48
|
+
def new_row(cells=None, parent_id=None, to_top=False):
|
|
49
|
+
new_row = Row()
|
|
50
|
+
if cells:
|
|
51
|
+
new_row.cells = cells
|
|
52
|
+
if parent_id:
|
|
53
|
+
new_row.parent_id = parent_id
|
|
54
|
+
if to_top:
|
|
55
|
+
new_row.to_top = to_top
|
|
56
|
+
return new_row
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: smartsheet_tools
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: A collection of convenience functions to aid with transitioning from simple-smartsheet to the SDK API and common tasks
|
|
5
5
|
Author: Ashton Pooley
|
|
6
6
|
Author-email: Ashton Pooley <ashton@ashi.digital>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
smartsheet_tools/__init__.py,sha256=LVXn-fARI98McLcctaxpF0SD7_RCh6Uu6RVxJmzMMTE,1683
|
|
2
|
+
smartsheet_tools-0.0.2.dist-info/licenses/LICENSE,sha256=xshMXNQ83e1x1bG3-9fQ5U8hnMaJsv79ke3xuKmI2PI,31914
|
|
3
|
+
smartsheet_tools-0.0.2.dist-info/METADATA,sha256=yD3p6zD6w9xi1oKAA6bszAzhThot4EOa_2aHnikX4sw,834
|
|
4
|
+
smartsheet_tools-0.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
smartsheet_tools-0.0.2.dist-info/top_level.txt,sha256=UXKUTK6mn1resx7hDN-MqSLi6ZnojUbkJ44VzmNmYi8,17
|
|
6
|
+
smartsheet_tools-0.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
smartsheet_tools
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
smartsheet_tools-0.0.1.dist-info/licenses/LICENSE,sha256=xshMXNQ83e1x1bG3-9fQ5U8hnMaJsv79ke3xuKmI2PI,31914
|
|
2
|
-
smartsheet_tools-0.0.1.dist-info/METADATA,sha256=0JXbYO3MWkrZl9TXDer_AM1oSjbapvyvYxzR_383n90,834
|
|
3
|
-
smartsheet_tools-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
-
smartsheet_tools-0.0.1.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
5
|
-
smartsheet_tools-0.0.1.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
File without changes
|