Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
start = self.get_addr(start, 'tuple')
if not include_empty:
matrix = values
else:
max_cols = len(max(values, key=len))
matrix = [list(x + ['']*(max_cols-len(x))) for x in values]
if returnas == 'matrix':
return matrix
else:
cells = []
for k in range(len(matrix)):
row = []
for i in range(len(matrix[k])):
if majdim == 'COLUMNS':
row.append(Cell((start[0]+i, start[1]+k), matrix[k][i], self))
elif majdim == 'ROWS':
row.append(Cell((start[0]+k, start[1]+i), matrix[k][i], self))
else:
raise InvalidArgumentValue('majdim')
cells.append(row)
return cells
matrix = values
else:
max_cols = len(max(values, key=len))
matrix = [list(x + ['']*(max_cols-len(x))) for x in values]
if returnas == 'matrix':
return matrix
else:
cells = []
for k in range(len(matrix)):
row = []
for i in range(len(matrix[k])):
if majdim == 'COLUMNS':
row.append(Cell((start[0]+i, start[1]+k), matrix[k][i], self))
elif majdim == 'ROWS':
row.append(Cell((start[0]+k, start[1]+i), matrix[k][i], self))
else:
raise InvalidArgumentValue('majdim')
cells.append(row)
return cells
"""
try:
if type(addr) is str:
val = self.client.get_range(self.spreadsheet.id, self._get_range(addr, addr), 'ROWS')[0][0]
elif type(addr) is tuple:
label = Worksheet.get_addr(addr, 'label')
val = self.client.get_range(self.spreadsheet.id, self._get_range(label, label), 'ROWS')[0][0]
else:
raise CellNotFound
except Exception as e:
if str(e).find('exceeds grid limits') != -1:
raise CellNotFound
else:
raise
return Cell(addr, val, self)