Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_cell(self, address):
cell_value = self.cell_map.get(str(address))
if cell_value is None:
return ExcelOpxWrapper.RangeData(address, '', None)
elif isinstance(cell_value, str) and cell_value.startswith('='):
return ExcelOpxWrapper.RangeData(address, cell_value, None)
else:
return ExcelOpxWrapper.RangeData(address, '', cell_value)
def _get_cell(self, address):
cell_value = self.cell_map.get(str(address))
if cell_value is None:
return ExcelOpxWrapper.RangeData(address, '', None)
elif isinstance(cell_value, str) and cell_value.startswith('='):
return ExcelOpxWrapper.RangeData(address, cell_value, None)
else:
return ExcelOpxWrapper.RangeData(address, '', cell_value)
def _get_cell(self, address):
cell_value = self.cell_map.get(str(address))
if cell_value is None:
return ExcelOpxWrapper.RangeData(address, '', None)
elif isinstance(cell_value, str) and cell_value.startswith('='):
return ExcelOpxWrapper.RangeData(address, cell_value, None)
else:
return ExcelOpxWrapper.RangeData(address, '', cell_value)
# this is a unbounded range to range mapping, disassemble
cell = self._get_cell(address)
formula = cell.formula
assert formula.startswith(REF_START)
assert formula.endswith(REF_END)
ref_addr = formula[len(REF_START):-len(REF_END)]
return self.get_range(AddressRange(ref_addr))
else:
# need to map col or row ranges to a specific range
addresses = address.resolve_range
cells = [[self._get_cell(addr) for addr in row]
for row in addresses]
values = [[c.values for c in row] for row in cells]
return ExcelOpxWrapper.RangeData(address, None, values)