🐛 fix missing long handler for ods, fix #57

This commit is contained in:
chfw 2018-11-21 19:30:40 +00:00
parent 317e170118
commit 92f694ba64
7 changed files with 25 additions and 15 deletions

View File

@ -31,7 +31,7 @@ author = u'C.W.'
# The short X.Y version
version = u'0.5.9'
# The full version, including alpha/beta/rc tags
release = u'0.5.9'
release = u'0.5.10'
# -- General configuration ---------------------------------------------------
@ -43,12 +43,7 @@ release = u'0.5.9'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
]
extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode',]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -75,7 +70,7 @@ language = 'en'
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = None
# -- Options for HTML output -------------------------------------------------

View File

@ -10,6 +10,7 @@
:Source code: http://github.com/pyexcel/pyexcel-io.git
:Issues: http://github.com/pyexcel/pyexcel-io/issues
:License: New BSD License
:Development: |release|
:Released: |version|
:Generated: |today|

View File

@ -1,8 +1,8 @@
overrides: "pyexcel.yaml"
name: "pyexcel-io"
nick_name: io
version: 0.5.9
current_version: 0.5.9
version: 0.5.10
current_version: 0.5.10
release: 0.5.9
dependencies:
- ordereddict;python_version<"2.7"

View File

@ -84,7 +84,7 @@ class CSVMemoryMapIterator(compact.Iterator):
if bom_header == BOM_BIG_ENDIAN:
self.__endian = BIG_ENDIAN
elif self.__endian == LITTLE_ENDIAN:
line = line[self.__zeros_left_in_2_row :] # flake8: noqa
line = line[self.__zeros_left_in_2_row :] # noqa: E203
if self.__endian == LITTLE_ENDIAN:
line = line.rstrip()
line = line.decode(self.__encoding)

View File

@ -127,7 +127,7 @@ def time_value(value):
"""convert to time value accroding the specification"""
import re
results = re.match("PT(\d+)H(\d+)M(\d+)S", value)
results = re.match(r"PT(\d+)H(\d+)M(\d+)S", value)
if results and len(results.groups()) == 3:
hour = int(results.group(1))
minute = int(results.group(2))
@ -178,6 +178,7 @@ ODS_WRITE_FORMAT_COVERSION = {
if PY2:
ODS_WRITE_FORMAT_COVERSION[unicode] = "string"
ODS_WRITE_FORMAT_COVERSION[long] = "float"
VALUE_CONVERTERS = {
"float": float_value,

View File

@ -5,13 +5,15 @@ import os
import sys
import codecs
from shutil import rmtree
from setuptools import setup, find_packages, Command
from setuptools import Command, setup, find_packages
PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7
NAME = 'pyexcel-io'
AUTHOR = 'C.W.'
VERSION = '0.5.9'
VERSION = '0.5.10'
EMAIL = 'wangc_2011@hotmail.com'
LICENSE = 'New BSD'
DESCRIPTION = (
@ -22,6 +24,7 @@ URL = 'https://github.com/pyexcel/pyexcel-io'
DOWNLOAD_URL = '%s/archive/0.5.9.tar.gz' % URL
FILES = ['README.rst', 'CHANGELOG.rst']
KEYWORDS = [
'python',
'API',
'tsv',
'tsvz',
@ -29,7 +32,6 @@ KEYWORDS = [
'csvz',
'django',
'sqlalchemy',
'python',
]
CLASSIFIERS = [

View File

@ -2,6 +2,9 @@ from nose.tools import eq_, raises
from pyexcel_io.service import date_value, time_value
from pyexcel_io.service import detect_int_value
from pyexcel_io.service import detect_float_value
from pyexcel_io.service import ODS_WRITE_FORMAT_COVERSION
from pyexcel_io._compact import PY2
from nose import SkipTest
def test_date_util_parse():
@ -89,3 +92,11 @@ def test_detect_float_value_on_custom_nan_text():
def test_detect_float_value_on_custom_nan_text2():
result = detect_float_value("nan", default_float_nan="nan")
eq_(str(result), "nan")
def test_ods_write_format_conversion():
if PY2:
expected = ODS_WRITE_FORMAT_COVERSION[long] # noqa: F821
eq_('float', expected)
else:
raise SkipTest