mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-02 15:11:13 -04:00
use iget_array to reduce memory footprint. and removed useless imports because they are loaded when required by pyexcel and lml
This commit is contained in:
18
app/utils.py
18
app/utils.py
@@ -22,10 +22,6 @@ from flask import (
|
||||
)
|
||||
from flask_login import current_user
|
||||
import pyexcel
|
||||
import pyexcel_io
|
||||
import pyexcel_xls
|
||||
import pyexcel_xlsx
|
||||
import pyexcel_ods3
|
||||
|
||||
from notifications_utils.template import (
|
||||
SMSPreviewTemplate,
|
||||
@@ -246,12 +242,16 @@ class Spreadsheet():
|
||||
return cls(Spreadsheet.normalise_newlines(file_content), filename)
|
||||
|
||||
if extension == 'tsv':
|
||||
file_content = StringIO(Spreadsheet.normalise_newlines(file_content))
|
||||
file_content = StringIO(
|
||||
Spreadsheet.normalise_newlines(file_content))
|
||||
|
||||
return cls.from_rows(pyexcel.get_sheet(
|
||||
file_type=extension,
|
||||
file_content=file_content.read()
|
||||
).to_array(), filename)
|
||||
instance = cls.from_rows(
|
||||
pyexcel.iget_array(
|
||||
file_type=extension,
|
||||
file_stream=file_content),
|
||||
filename)
|
||||
pyexcel.free_resources()
|
||||
return instance
|
||||
|
||||
|
||||
def get_help_argument():
|
||||
|
||||
Reference in New Issue
Block a user