🤝 sync using moban

This commit is contained in:
chfw 2018-05-23 08:22:53 +01:00
parent c0b438154e
commit 35a0a74401
8 changed files with 56 additions and 38 deletions

1
.gitignore vendored
View File

@ -96,4 +96,3 @@ ENV/
# moban hashes
.moban.hashes
.DS_store

View File

@ -1,4 +1,4 @@
Copyright (c) 2015-2017 by Onni Software Ltd. and its contributors
Copyright (c) 2015-2018 by Onni Software Ltd. and its contributors
All rights reserved.
Redistribution and use in source and binary forms of the software as well

View File

@ -5,7 +5,10 @@ pyexcel-ods - Let you focus on data, instead of ods format
.. image:: https://raw.githubusercontent.com/pyexcel/pyexcel.github.io/master/images/patreon.png
:target: https://www.patreon.com/pyexcel
.. image:: https://api.travis-ci.org/pyexcel/pyexcel-ods.svg?branch=master
.. image:: https://api.bountysource.com/badge/team?team_id=288537
:target: https://salt.bountysource.com/teams/chfw-pyexcel
.. image:: https://travis-ci.org/pyexcel/pyexcel-ods.svg?branch=master
:target: http://travis-ci.org/pyexcel/pyexcel-ods
.. image:: https://codecov.io/gh/pyexcel/pyexcel-ods/branch/master/graph/badge.svg
@ -50,13 +53,16 @@ Support the project
================================================================================
If your company has embedded pyexcel and its components into a revenue generating
product, please `support me on patreon <https://www.patreon.com/bePatron?u=5537627>`_ to
maintain the project and develop it further.
product, please support me on `patreon <https://www.patreon.com/bePatron?u=5537627>`_
or `bounty source <https://salt.bountysource.com/teams/chfw-pyexcel>`_ to maintain
the project and develop it further.
If you are an individual, you are welcome to support me too on patreon and for however long
you feel like. As a patreon, you will receive
If you are an individual, you are welcome to support me too and for however long
you feel like. As my backer, you will receive
`early access to pyexcel related contents <https://www.patreon.com/pyexcel/posts>`_.
And your issues will get prioritized if you would like to become my patreon as `pyexcel pro user`.
With your financial support, I will be able to invest
a little bit more time in coding, documentation and writing interesting posts.

View File

@ -9,19 +9,17 @@ extensions = [
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
]
intersphinx_mapping = {
'pyexcel': ('http://pyexcel.readthedocs.io/en/latest/', None),
}
spelling_word_list_filename = 'spelling_wordlist.txt'
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'pyexcel-ods'
copyright = u'2015-2017 Onni Software Ltd.'
copyright = u'2015-2018 Onni Software Ltd.'
version = '0.5.2'
release = '0.5.2'
release = '0.5.3'
exclude_patterns = []
pygments_style = 'sphinx'
html_theme = 'default'

View File

@ -1,8 +1,8 @@
overrides: "pyexcel.yaml"
name: "pyexcel-ods"
nick_name: ods
version: 0.5.2
current_version: 0.5.2
version: 0.5.3
current_version: 0.5.3
release: 0.5.2
file_type: ods
dependencies:

View File

@ -1,4 +1,6 @@
# Template by setupmobans
#!/usr/bin/env python3
# Template by pypi-mobans
import os
import sys
import codecs
@ -7,23 +9,20 @@ from setuptools import setup, find_packages, Command
NAME = 'pyexcel-ods'
AUTHOR = 'C.W.'
VERSION = '0.5.2'
VERSION = '0.5.3'
EMAIL = 'wangc_2011@hotmail.com'
LICENSE = 'New BSD'
DESCRIPTION = (
'A wrapper library to read, manipulate and write data in ods format' +
''
'A wrapper library to read, manipulate and write data in ods format'
)
URL = 'https://github.com/pyexcel/pyexcel-ods'
DOWNLOAD_URL = '%s/archive/0.5.2.tar.gz' % URL
FILES = ['README.rst', 'CHANGELOG.rst']
FILES = ['README.rst', 'CHANGELOG.rst']
KEYWORDS = [
'python'
]
CLASSIFIERS = [
'Topic :: Office/Business',
'Topic :: Utilities',
'Topic :: Software Development :: Libraries',
'Programming Language :: Python',
'Intended Audience :: Developers',
@ -39,6 +38,7 @@ INSTALL_REQUIRES = [
'pyexcel-io>=0.5.3',
'odfpy>=1.3.3',
]
SETUP_COMMANDS = {}
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests'])
@ -51,7 +51,8 @@ GS_COMMAND = ('gs pyexcel-ods v0.5.2 ' +
"Find 0.5.2 in changelog for more details")
NO_GS_MESSAGE = ('Automatic github release is disabled. ' +
'Please install gease to enable it.')
UPLOAD_FAILED_MSG = ('Upload failed. please run "%s" yourself.')
UPLOAD_FAILED_MSG = (
'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND)
HERE = os.path.abspath(os.path.dirname(__file__))
@ -76,6 +77,8 @@ class PublishCommand(Command):
try:
self.status('Removing previous builds...')
rmtree(os.path.join(HERE, 'dist'))
rmtree(os.path.join(HERE, 'build'))
rmtree(os.path.join(HERE, 'pyexcel_ods.egg-info'))
except OSError:
pass
@ -92,6 +95,11 @@ class PublishCommand(Command):
sys.exit()
SETUP_COMMANDS.update({
'publish': PublishCommand
})
def has_gease():
"""
test if github release command is installed
@ -116,7 +124,8 @@ def read_files(*files):
def read(afile):
"""Read a file into setup"""
with codecs.open(afile, 'r', 'utf-8') as opened_file:
the_relative_file = os.path.join(HERE, afile)
with codecs.open(the_relative_file, 'r', 'utf-8') as opened_file:
content = filter_out_test_code(opened_file)
content = "".join(list(content))
return content
@ -165,7 +174,5 @@ if __name__ == '__main__':
include_package_data=True,
zip_safe=False,
classifiers=CLASSIFIERS,
cmdclass={
'publish': PublishCommand,
}
cmdclass=SETUP_COMMANDS
)

View File

@ -1,51 +1,57 @@
import os
from unittest import TestCase
from textwrap import dedent
from nose.tools import eq_
import pyexcel as pe
class TestAutoDetectInt(TestCase):
class TestAutoDetectInt:
def setUp(self):
self.content = [[1, 2, 3.1]]
self.test_file = "test_auto_detect_init.ods"
pe.save_as(array=self.content, dest_file_name=self.test_file)
pe.save_as(
array=self.content, dest_file_name=self.test_file
)
def test_auto_detect_int(self):
sheet = pe.get_sheet(file_name=self.test_file)
sheet = pe.get_sheet(file_name=self.test_file, library="pyexcel-ods")
expected = dedent("""
pyexcel_sheet1:
+---+---+-----+
| 1 | 2 | 3.1 |
+---+---+-----+""").strip()
self.assertEqual(str(sheet), expected)
eq_(str(sheet), expected)
def test_get_book_auto_detect_int(self):
book = pe.get_book(file_name=self.test_file)
book = pe.get_book(file_name=self.test_file, library="pyexcel-ods")
expected = dedent("""
pyexcel_sheet1:
+---+---+-----+
| 1 | 2 | 3.1 |
+---+---+-----+""").strip()
self.assertEqual(str(book), expected)
eq_(str(book), expected)
def test_auto_detect_int_false(self):
sheet = pe.get_sheet(file_name=self.test_file, auto_detect_int=False)
sheet = pe.get_sheet(file_name=self.test_file, auto_detect_int=False,
library="pyexcel-ods")
expected = dedent("""
pyexcel_sheet1:
+-----+-----+-----+
| 1.0 | 2.0 | 3.1 |
+-----+-----+-----+""").strip()
self.assertEqual(str(sheet), expected)
eq_(str(sheet), expected)
def test_get_book_auto_detect_int_false(self):
book = pe.get_book(file_name=self.test_file, auto_detect_int=False)
book = pe.get_book(file_name=self.test_file, auto_detect_int=False,
library="pyexcel-ods")
expected = dedent("""
pyexcel_sheet1:
+-----+-----+-----+
| 1.0 | 2.0 | 3.1 |
+-----+-----+-----+""").strip()
self.assertEqual(str(book), expected)
eq_(str(book), expected)
def tearDown(self):
os.unlink(self.test_file)

View File

@ -11,7 +11,8 @@ class TestStringIO:
create_sample_file1(testfile)
with open(testfile, "rb") as f:
content = f.read()
r = pyexcel.get_sheet(file_type="ods", file_content=content)
r = pyexcel.get_sheet(file_type="ods", file_content=content,
library="pyexcel-ods")
result = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 1.1, 1]
actual = list(r.enumerate())
eq_(result, actual)
@ -25,7 +26,8 @@ class TestStringIO:
]
io = pyexcel.save_as(dest_file_type="ods",
array=data)
r = pyexcel.get_sheet(file_type="ods", file_content=io.getvalue())
r = pyexcel.get_sheet(file_type="ods", file_content=io.getvalue(),
library="pyexcel-ods")
result = [1, 2, 3, 4, 5, 6]
actual = list(r.enumerate())
eq_(result, actual)