smartsheet-tools 0.0.1__tar.gz → 0.0.2__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.
- {smartsheet_tools-0.0.1/smartsheet_tools.egg-info → smartsheet_tools-0.0.2}/PKG-INFO +1 -1
- {smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2}/pyproject.toml +1 -1
- {smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2}/setup.py +2 -2
- smartsheet_tools-0.0.2/smartsheet_tools/__init__.py +56 -0
- {smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2/smartsheet_tools.egg-info}/PKG-INFO +1 -1
- {smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2}/smartsheet_tools.egg-info/SOURCES.txt +1 -0
- smartsheet_tools-0.0.2/smartsheet_tools.egg-info/top_level.txt +1 -0
- smartsheet_tools-0.0.1/smartsheet_tools.egg-info/top_level.txt +0 -1
- {smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2}/LICENSE +0 -0
- {smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2}/README.md +0 -0
- {smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2}/setup.cfg +0 -0
- {smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2}/smartsheet_tools.egg-info/dependency_links.txt +0 -0
- {smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2}/smartsheet_tools.egg-info/requires.txt +0 -0
|
@@ -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>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "smartsheet_tools" # from setup.py
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.2" # from setup.py
|
|
8
8
|
description = "A collection of convenience functions to aid with transitioning from simple-smartsheet to the SDK API and common tasks"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9" # matches classifiers (3.9–3.12)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from setuptools import
|
|
1
|
+
from setuptools import setup
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="smartsheet_tools",
|
|
5
|
-
version="0.0.
|
|
5
|
+
version="0.0.2",
|
|
6
6
|
description="A collection of convenience functions to aid with transitioning from simple-smartsheet to the SDK API and common tasks",
|
|
7
7
|
author="Ashton Pooley",
|
|
8
8
|
author_email="Ashton@ashi.digital",
|
|
@@ -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 @@
|
|
|
1
|
+
smartsheet_tools
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smartsheet_tools-0.0.1 → smartsheet_tools-0.0.2}/smartsheet_tools.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|