code refactoring: remove useless code
This commit is contained in:
parent
745f56adf8
commit
d1e146748e
55
README.rst
55
README.rst
|
@ -314,28 +314,16 @@ Then install relevant development requirements:
|
|||
#. pip install -r requirements.txt
|
||||
#. pip install -r tests/requirements.txt
|
||||
|
||||
Once you have finished your changes, please provide test case(s), relevant documentation
|
||||
and update CHANGELOG.rst.
|
||||
|
||||
In order to update test environment, and documentation, additional steps are
|
||||
required:
|
||||
.. note::
|
||||
|
||||
#. pip install moban
|
||||
#. git clone https://github.com/pyexcel/pyexcel-commons.git commons
|
||||
#. make your changes in `.moban.d` directory, then issue command `moban`
|
||||
As to rnd_requirements.txt, usually, it is created when a dependent
|
||||
library is not released. Once the dependecy is installed
|
||||
(will be released), the future
|
||||
version of the dependency in the requirements.txt will be valid.
|
||||
|
||||
What is rnd_requirements.txt
|
||||
-------------------------------
|
||||
|
||||
Usually, it is created when a dependent library is not released. Once the dependecy is installed(will be released), the future version of the dependency in the requirements.txt will be valid.
|
||||
|
||||
What is pyexcel-commons
|
||||
---------------------------------
|
||||
|
||||
Many information that are shared across pyexcel projects, such as: this developer guide, license info, etc. are stored in `pyexcel-commons` project.
|
||||
|
||||
What is .moban.d
|
||||
---------------------------------
|
||||
|
||||
`.moban.d` stores the specific meta data for the library.
|
||||
|
||||
How to test your contribution
|
||||
------------------------------
|
||||
|
@ -350,6 +338,35 @@ On Windows systems, please issue this command::
|
|||
|
||||
> test.bat
|
||||
|
||||
How to update test environment and update documentation
|
||||
---------------------------------------------------------
|
||||
|
||||
Additional steps are required:
|
||||
|
||||
#. pip install moban
|
||||
#. git clone https://github.com/pyexcel/pyexcel-commons.git commons
|
||||
#. make your changes in `.moban.d` directory, then issue command `moban`
|
||||
|
||||
What is pyexcel-commons
|
||||
---------------------------------
|
||||
|
||||
Many information that are shared across pyexcel projects, such as: this developer guide, license info, etc. are stored in `pyexcel-commons` project.
|
||||
|
||||
What is .moban.d
|
||||
---------------------------------
|
||||
|
||||
`.moban.d` stores the specific meta data for the library.
|
||||
|
||||
Acceptance criteria
|
||||
-------------------
|
||||
|
||||
#. Has Test cases written
|
||||
#. Has all code lines tested
|
||||
#. Passes all Travis CI builds
|
||||
#. Has fair amount of documentation if your change is complex
|
||||
#. Agree on NEW BSD License for your contribution
|
||||
|
||||
|
||||
Credits
|
||||
================================================================================
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ master_doc = 'index'
|
|||
project = u'pyexcel-ods'
|
||||
copyright = u'2015-2017 Onni Software Ltd.'
|
||||
version = '0.4.0'
|
||||
release = '0.4.0'
|
||||
release = '0.4.1'
|
||||
exclude_patterns = []
|
||||
pygments_style = 'sphinx'
|
||||
html_theme = 'default'
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
overrides: "pyexcel.yaml"
|
||||
name: "pyexcel-ods"
|
||||
nick_name: ods
|
||||
version: 0.4.0
|
||||
version: 0.4.1
|
||||
current_version: 0.4.1
|
||||
release: 0.4.0
|
||||
file_type: ods
|
||||
dependencies:
|
||||
|
|
|
@ -61,34 +61,6 @@ class ODSSheet(SheetReader):
|
|||
else:
|
||||
yield cell_value
|
||||
|
||||
def __read_row(self, cells):
|
||||
tmp_row = []
|
||||
for cell in cells:
|
||||
# repeated value?
|
||||
repeat = cell.getAttribute("numbercolumnsrepeated")
|
||||
cell_value = self.__read_cell(cell)
|
||||
if repeat:
|
||||
number_of_repeat = int(repeat)
|
||||
tmp_row += [cell_value] * number_of_repeat
|
||||
else:
|
||||
tmp_row.append(cell_value)
|
||||
return tmp_row
|
||||
|
||||
def __read_text_cell(self, cell):
|
||||
text_content = []
|
||||
paragraphs = cell.getElementsByType(P)
|
||||
# for each text node
|
||||
for paragraph in paragraphs:
|
||||
data = ''
|
||||
for node in paragraph.childNodes:
|
||||
if (node.nodeType == 3):
|
||||
if PY2:
|
||||
data += unicode(node.data)
|
||||
else:
|
||||
data += node.data
|
||||
text_content.append(data)
|
||||
return '\n'.join(text_content)
|
||||
|
||||
def __read_cell(self, cell):
|
||||
cell_type = cell.getAttrNS(OFFICENS, "value-type")
|
||||
value_token = converter.VALUE_TOKEN.get(cell_type, "value")
|
||||
|
@ -105,7 +77,7 @@ class ODSSheet(SheetReader):
|
|||
value = cell.getAttrNS(OFFICENS, value_token)
|
||||
n_value = converter.VALUE_CONVERTERS[cell_type](value)
|
||||
if cell_type == 'float' and self.__auto_detect_int:
|
||||
if is_integer_ok_for_xl_float(n_value):
|
||||
if _is_integer_ok_for_xl_float(n_value):
|
||||
n_value = int(n_value)
|
||||
ret = n_value
|
||||
else:
|
||||
|
@ -113,6 +85,21 @@ class ODSSheet(SheetReader):
|
|||
ret = text_content
|
||||
return ret
|
||||
|
||||
def __read_text_cell(self, cell):
|
||||
text_content = []
|
||||
paragraphs = cell.getElementsByType(P)
|
||||
# for each text node
|
||||
for paragraph in paragraphs:
|
||||
data = ''
|
||||
for node in paragraph.childNodes:
|
||||
if (node.nodeType == 3):
|
||||
if PY2:
|
||||
data += unicode(node.data)
|
||||
else:
|
||||
data += node.data
|
||||
text_content.append(data)
|
||||
return '\n'.join(text_content)
|
||||
|
||||
|
||||
class ODSBook(BookReader):
|
||||
"""read ods book"""
|
||||
|
@ -170,6 +157,6 @@ class ODSBook(BookReader):
|
|||
self._native_book = load(self._file_name)
|
||||
|
||||
|
||||
def is_integer_ok_for_xl_float(value):
|
||||
def _is_integer_ok_for_xl_float(value):
|
||||
"""check if a float had zero value in digits"""
|
||||
return value == math.floor(value)
|
||||
|
|
Loading…
Reference in New Issue