Skip to content

Commit

Permalink
🔥 remove useless code as it is now handled in pyexcel-io
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Aug 25, 2017
1 parent f5bbf7e commit bb8b97f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 149 deletions.
135 changes: 0 additions & 135 deletions pyexcel_ods/converter.py

This file was deleted.

17 changes: 5 additions & 12 deletions pyexcel_ods/odsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# limitations under the License.

# Thanks to grt for the fixes
import math
from io import UnsupportedOperation

from odf.teletype import extractText
Expand All @@ -34,8 +33,7 @@
from pyexcel_io.book import BookReader
from pyexcel_io.sheet import SheetReader
from pyexcel_io._compact import OrderedDict, BytesIO

import pyexcel_ods.converter as converter
import pyexcel_io.service as service


class ODSSheet(SheetReader):
Expand Down Expand Up @@ -65,7 +63,7 @@ def column_iterator(self, row):

def __read_cell(self, cell):
cell_type = cell.getAttrNS(OFFICENS, "value-type")
value_token = converter.VALUE_TOKEN.get(cell_type, "value")
value_token = service.VALUE_TOKEN.get(cell_type, "value")
ret = None
if cell_type == "string":
text_content = self.__read_text_cell(cell)
Expand All @@ -75,11 +73,11 @@ def __read_cell(self, cell):
currency = cell.getAttrNS(OFFICENS, cell_type)
ret = value + ' ' + currency
else:
if cell_type in converter.VALUE_CONVERTERS:
if cell_type in service.VALUE_CONVERTERS:
value = cell.getAttrNS(OFFICENS, value_token)
n_value = converter.VALUE_CONVERTERS[cell_type](value)
n_value = service.VALUE_CONVERTERS[cell_type](value)
if cell_type == 'float' and self.__auto_detect_int:
if _is_integer_ok_for_xl_float(n_value):
if service.has_no_digits_in_float(n_value):
n_value = int(n_value)
ret = n_value
else:
Expand Down Expand Up @@ -161,8 +159,3 @@ def _load_from_memory(self):

def _load_from_file(self):
self._native_book = load(self._file_name)


def _is_integer_ok_for_xl_float(value):
"""check if a float had zero value in digits"""
return value == math.floor(value)
4 changes: 2 additions & 2 deletions rnd_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
https://github.com/chfw/lml/archive/master.zip
https://github.com/pyexcel/pyexcel-io/archive/master.zip
https://github.com/pyexcel/pyexcel-io/archive/dev.zip
https://github.com/pyexcel/pyexcel/archive/master.zip
https://github.com/pyexcel/pyexcel-xls/archive/master.zip
https://github.com/pyexcel/pyexcel-xls/archive/dev.zip

0 comments on commit bb8b97f

Please sign in to comment.