smartsheet-tools 0.0.6__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.
@@ -61,7 +61,11 @@ def get_cached_column_type(column_id, sheet_obj, prefill=False):
61
61
 
62
62
  if column_id not in _COLUMN_TYPE_CACHE[sheet_obj.id]:
63
63
  if not prefill:
64
- _COLUMN_TYPE_CACHE[sheet_obj.id][column_id] = str(sheet_obj.get_column(column_id).type)
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
+
65
69
  else:
66
70
  _COLUMN_TYPE_CACHE[sheet_obj.id][column_id] = prefill
67
71
 
@@ -70,6 +74,9 @@ def get_cached_column_type(column_id, sheet_obj, prefill=False):
70
74
  def get_col_names_of_date_cols(sheet_obj):
71
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")]
72
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"]
79
+
73
80
  def brute_force_date_string(s, nonetype_if_fail=False):
74
81
  # attempt to parse a date string in common formats to ISO 8601
75
82
  if isinstance(s, datetime):
@@ -91,16 +98,16 @@ def is_date_col(column_id, sheet_obj):
91
98
  column_type = get_cached_column_type(column_id, sheet_obj)
92
99
  return column_type in ("DATE", "DATETIME")
93
100
 
94
- def correct_date_format(isoformat_datetime, column_id, sheet_obj):
95
- if isinstance(isoformat_datetime, datetime):
96
- isoformat_datetime = datetime_to_isoformat(isoformat_datetime)
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)
97
104
 
98
105
  column_type = get_cached_column_type(column_id, sheet_obj)
99
106
  if column_type == "DATE":
100
- return isoformat_datetime.split("T",1)[0]
107
+ return value.split("T",1)[0]
101
108
  elif column_type == "DATETIME":
102
- return isoformat_datetime
103
- return None
109
+ return value
110
+ return None if nonetype_if_fail else value
104
111
 
105
112
  def new_cell(column_id=None, value=None, strict=False, formula=None):
106
113
  new_cell = Cell()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smartsheet_tools
3
- Version: 0.0.6
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=LVm1iRzWDUnvORe0gaJWVYlOS_-7LER1zbhJG3828Q8,6544
2
- smartsheet_tools-0.0.6.dist-info/licenses/LICENSE,sha256=xshMXNQ83e1x1bG3-9fQ5U8hnMaJsv79ke3xuKmI2PI,31914
3
- smartsheet_tools-0.0.6.dist-info/METADATA,sha256=RhltbsXCVgmWiJR0xEVzQ0NQD74c1Bg2_4BGOgGCmzE,834
4
- smartsheet_tools-0.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- smartsheet_tools-0.0.6.dist-info/top_level.txt,sha256=UXKUTK6mn1resx7hDN-MqSLi6ZnojUbkJ44VzmNmYi8,17
6
- smartsheet_tools-0.0.6.dist-info/RECORD,,