Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sheet_path = None
if sheet_path is None:
sheet_path = "/xl/worksheets/worksheet%i.xml" % sheet_index
sheet_file = self._filehandle(sheet_path)
if sheet_file is None:
sheet_path = None
if sheet_path is None and sheet_index == 1:
sheet_path = self.content_types.types["worksheet"]
sheet_file = self._filehandle(sheet_path)
if sheet_file is None:
sheet_path = None
if sheet_file is None and sheet_path is not None:
sheet_file = self._filehandle(sheet_path)
if sheet_file is None:
raise SheetNotFoundException("Sheet %i not found" % sheet_index)
sheet = Sheet(self.workbook, self.shared_strings, self.styles, sheet_file)
try:
relationships_path = os.path.join(os.path.dirname(sheet_path),
"_rels",
os.path.basename(sheet_path) + ".rels")
sheet.relationships = self._parse(Relationships, relationships_path)
sheet.set_dateformat(self.options['dateformat'])
sheet.set_timeformat(self.options['timeformat'])
sheet.set_floatformat(self.options['floatformat'])
sheet.set_skip_empty_lines(self.options['skip_empty_lines'])
sheet.set_skip_trailing_columns(self.options['skip_trailing_columns'])
sheet.set_include_hyperlinks(self.options['hyperlinks'])
sheet.set_merge_cells(self.options['merge_cells'])
sheet.set_scifloat(self.options['scifloat'])
sheet.set_ignore_formats(self.options['ignore_formats'])
if self.options['escape_strings'] and sheet.filedata:
sheet.filedata = re.sub(r"([^<>]+)
([^<>]+)", r"\1\\n\2",