smartsheet-tools 0.0.5__py3-none-any.whl → 0.0.7__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 +19 -9
- {smartsheet_tools-0.0.5.dist-info → smartsheet_tools-0.0.7.dist-info}/METADATA +1 -1
- smartsheet_tools-0.0.7.dist-info/RECORD +6 -0
- smartsheet_tools-0.0.5.dist-info/RECORD +0 -6
- {smartsheet_tools-0.0.5.dist-info → smartsheet_tools-0.0.7.dist-info}/WHEEL +0 -0
- {smartsheet_tools-0.0.5.dist-info → smartsheet_tools-0.0.7.dist-info}/licenses/LICENSE +0 -0
- {smartsheet_tools-0.0.5.dist-info → smartsheet_tools-0.0.7.dist-info}/top_level.txt +0 -0
smartsheet_tools/__init__.py
CHANGED
|
@@ -55,17 +55,27 @@ def standard_time_to_isoformat(st):
|
|
|
55
55
|
return None
|
|
56
56
|
return datetime_to_isoformat(datetime.strptime(st, "%m/%d/%Y"))
|
|
57
57
|
|
|
58
|
-
def get_cached_column_type(column_id, sheet_obj):
|
|
58
|
+
def get_cached_column_type(column_id, sheet_obj, prefill=False):
|
|
59
59
|
if sheet_obj.id not in _COLUMN_TYPE_CACHE:
|
|
60
60
|
_COLUMN_TYPE_CACHE[sheet_obj.id] = {}
|
|
61
61
|
|
|
62
62
|
if column_id not in _COLUMN_TYPE_CACHE[sheet_obj.id]:
|
|
63
|
-
|
|
63
|
+
if not prefill:
|
|
64
|
+
|
|
65
|
+
# Value is not in there and no prefill, so look it up
|
|
66
|
+
for col in sheet_obj.columns:
|
|
67
|
+
_COLUMN_TYPE_CACHE[sheet_obj.id][column_id] = col.type
|
|
68
|
+
|
|
69
|
+
else:
|
|
70
|
+
_COLUMN_TYPE_CACHE[sheet_obj.id][column_id] = prefill
|
|
64
71
|
|
|
65
72
|
return _COLUMN_TYPE_CACHE[sheet_obj.id][column_id]
|
|
66
73
|
|
|
67
74
|
def get_col_names_of_date_cols(sheet_obj):
|
|
68
|
-
return [c.title for c in sheet_obj.columns if get_cached_column_type(c.id, sheet_obj) in ("DATE", "DATETIME")]
|
|
75
|
+
return [c.title for c in sheet_obj.columns if get_cached_column_type(c.id, sheet_obj, prefill=c.type) in ("DATE", "DATETIME")]
|
|
76
|
+
|
|
77
|
+
def get_col_names_of_bool_cols(sheet_obj):
|
|
78
|
+
return [c.title for c in sheet_obj.columns if get_cached_column_type(c.id, sheet_obj, prefill=c.type) == "CHECKBOX"]
|
|
69
79
|
|
|
70
80
|
def brute_force_date_string(s, nonetype_if_fail=False):
|
|
71
81
|
# attempt to parse a date string in common formats to ISO 8601
|
|
@@ -88,16 +98,16 @@ def is_date_col(column_id, sheet_obj):
|
|
|
88
98
|
column_type = get_cached_column_type(column_id, sheet_obj)
|
|
89
99
|
return column_type in ("DATE", "DATETIME")
|
|
90
100
|
|
|
91
|
-
def correct_date_format(
|
|
92
|
-
if isinstance(
|
|
93
|
-
|
|
101
|
+
def correct_date_format(value, column_id, sheet_obj, nonetype_if_fail=False):
|
|
102
|
+
if isinstance(value, datetime):
|
|
103
|
+
value = datetime_to_isoformat(value)
|
|
94
104
|
|
|
95
105
|
column_type = get_cached_column_type(column_id, sheet_obj)
|
|
96
106
|
if column_type == "DATE":
|
|
97
|
-
return
|
|
107
|
+
return value.split("T",1)[0]
|
|
98
108
|
elif column_type == "DATETIME":
|
|
99
|
-
return
|
|
100
|
-
return None
|
|
109
|
+
return value
|
|
110
|
+
return None if nonetype_if_fail else value
|
|
101
111
|
|
|
102
112
|
def new_cell(column_id=None, value=None, strict=False, formula=None):
|
|
103
113
|
new_cell = Cell()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: smartsheet_tools
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
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=whnuWHiAyhEcRHQLF178lptsvjULJWReznb1IomVglo,6786
|
|
2
|
+
smartsheet_tools-0.0.7.dist-info/licenses/LICENSE,sha256=xshMXNQ83e1x1bG3-9fQ5U8hnMaJsv79ke3xuKmI2PI,31914
|
|
3
|
+
smartsheet_tools-0.0.7.dist-info/METADATA,sha256=5hqqP0dXb5kdc65oc2eD97VyCwqcZfNT4GA4o38cGRk,834
|
|
4
|
+
smartsheet_tools-0.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
smartsheet_tools-0.0.7.dist-info/top_level.txt,sha256=UXKUTK6mn1resx7hDN-MqSLi6ZnojUbkJ44VzmNmYi8,17
|
|
6
|
+
smartsheet_tools-0.0.7.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
smartsheet_tools/__init__.py,sha256=v93h3pS1UQAW5yWFo-5jVsKIshscWYh9U93ExT99HYY,6402
|
|
2
|
-
smartsheet_tools-0.0.5.dist-info/licenses/LICENSE,sha256=xshMXNQ83e1x1bG3-9fQ5U8hnMaJsv79ke3xuKmI2PI,31914
|
|
3
|
-
smartsheet_tools-0.0.5.dist-info/METADATA,sha256=rJFnnTevc8RA4aLpHdtCIgHp-H5ytTCZFH-_nGWdOE0,834
|
|
4
|
-
smartsheet_tools-0.0.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
smartsheet_tools-0.0.5.dist-info/top_level.txt,sha256=UXKUTK6mn1resx7hDN-MqSLi6ZnojUbkJ44VzmNmYi8,17
|
|
6
|
-
smartsheet_tools-0.0.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|