mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Merge pull request #1426 from pyexcel/master
use iget_array to reduce memory footprint. and removed useless import…
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
|
from flask_login import current_user
|
||||||
import pyexcel
|
import pyexcel
|
||||||
import pyexcel_io
|
|
||||||
import pyexcel_xls
|
|
||||||
import pyexcel_xlsx
|
|
||||||
import pyexcel_ods3
|
|
||||||
|
|
||||||
from notifications_utils.template import (
|
from notifications_utils.template import (
|
||||||
SMSPreviewTemplate,
|
SMSPreviewTemplate,
|
||||||
@@ -246,12 +242,16 @@ class Spreadsheet():
|
|||||||
return cls(Spreadsheet.normalise_newlines(file_content), filename)
|
return cls(Spreadsheet.normalise_newlines(file_content), filename)
|
||||||
|
|
||||||
if extension == 'tsv':
|
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(
|
instance = cls.from_rows(
|
||||||
file_type=extension,
|
pyexcel.iget_array(
|
||||||
file_content=file_content.read()
|
file_type=extension,
|
||||||
).to_array(), filename)
|
file_stream=file_content),
|
||||||
|
filename)
|
||||||
|
pyexcel.free_resources()
|
||||||
|
return instance
|
||||||
|
|
||||||
|
|
||||||
def get_help_argument():
|
def get_help_argument():
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pyexcel==0.5.3
|
|||||||
pyexcel-io==0.4.4
|
pyexcel-io==0.4.4
|
||||||
pyexcel-xls==0.4.0
|
pyexcel-xls==0.4.0
|
||||||
pyexcel-xlsx==0.4.1
|
pyexcel-xlsx==0.4.1
|
||||||
pyexcel-ods3==0.4.0
|
pyexcel-ods3==0.4.1
|
||||||
pytz==2017.2
|
pytz==2017.2
|
||||||
six==1.10.0
|
six==1.10.0
|
||||||
gunicorn==19.7.1
|
gunicorn==19.7.1
|
||||||
|
|||||||
Reference in New Issue
Block a user