diff --git a/setup.py b/setup.py index 56d06f3f..2ba3e767 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,6 @@ from setuptools import find_packages, setup - install = [ 'odfpy', 'openpyxl>=2.4.0', diff --git a/src/tablib/__init__.py b/src/tablib/__init__.py index fafb569a..e94e9394 100644 --- a/src/tablib/__init__.py +++ b/src/tablib/__init__.py @@ -1,9 +1,15 @@ """ Tablib. """ -from pkg_resources import get_distribution, DistributionNotFound +from pkg_resources import DistributionNotFound, get_distribution from tablib.core import ( - Databook, Dataset, detect_format, import_set, import_book, - InvalidDatasetType, InvalidDimensions, UnsupportedFormat + Databook, + Dataset, + InvalidDatasetType, + InvalidDimensions, + UnsupportedFormat, + detect_format, + import_book, + import_set, ) try: diff --git a/src/tablib/core.py b/src/tablib/core.py index 61c7a500..17d9621c 100644 --- a/src/tablib/core.py +++ b/src/tablib/core.py @@ -14,7 +14,6 @@ from tablib import formats - __title__ = 'tablib' __author__ = 'Kenneth Reitz' __license__ = 'MIT' diff --git a/src/tablib/formats/__init__.py b/src/tablib/formats/__init__.py index 9542d9a1..12f2610e 100644 --- a/src/tablib/formats/__init__.py +++ b/src/tablib/formats/__init__.py @@ -2,18 +2,18 @@ """ from . import _csv as csv -from . import _json as json -from . import _xls as xls -from . import _yaml as yaml -from . import _tsv as tsv -from . import _html as html -from . import _xlsx as xlsx -from . import _ods as ods from . import _dbf as dbf -from . import _latex as latex from . import _df as df -from . import _rst as rst +from . import _html as html from . import _jira as jira +from . import _json as json +from . import _latex as latex +from . import _ods as ods +from . import _rst as rst +from . import _tsv as tsv +from . import _xls as xls +from . import _xlsx as xlsx +from . import _yaml as yaml # xlsx before as xls (xlrd) can also read xlsx available = (json, xlsx, xls, yaml, csv, dbf, tsv, html, jira, latex, ods, df, rst) diff --git a/src/tablib/formats/_csv.py b/src/tablib/formats/_csv.py index 975d1714..8bd3728c 100644 --- a/src/tablib/formats/_csv.py +++ b/src/tablib/formats/_csv.py @@ -4,7 +4,6 @@ import csv from io import StringIO - title = 'csv' extensions = ('csv',) diff --git a/src/tablib/formats/_dbf.py b/src/tablib/formats/_dbf.py index 2a6df323..7ac814e0 100644 --- a/src/tablib/formats/_dbf.py +++ b/src/tablib/formats/_dbf.py @@ -4,11 +4,9 @@ import os import tempfile -from tablib.packages.dbfpy import dbf -from tablib.packages.dbfpy import dbfnew +from tablib.packages.dbfpy import dbf, dbfnew from tablib.packages.dbfpy import record as dbfrecord - title = 'dbf' extensions = ('csv',) diff --git a/src/tablib/formats/_json.py b/src/tablib/formats/_json.py index f427ff2e..98879ac2 100644 --- a/src/tablib/formats/_json.py +++ b/src/tablib/formats/_json.py @@ -6,7 +6,6 @@ import tablib - title = 'json' extensions = ('json', 'jsn') diff --git a/src/tablib/formats/_latex.py b/src/tablib/formats/_latex.py index fae2ceb2..0b1e3bc5 100644 --- a/src/tablib/formats/_latex.py +++ b/src/tablib/formats/_latex.py @@ -4,7 +4,6 @@ """ import re - title = 'latex' extensions = ('tex',) diff --git a/src/tablib/formats/_ods.py b/src/tablib/formats/_ods.py index 43a2cfb7..c8745147 100644 --- a/src/tablib/formats/_ods.py +++ b/src/tablib/formats/_ods.py @@ -2,6 +2,7 @@ """ from io import BytesIO + from odf import opendocument, style, table, text title = 'ods' diff --git a/src/tablib/formats/_rst.py b/src/tablib/formats/_rst.py index 8067f73e..3f8c369e 100644 --- a/src/tablib/formats/_rst.py +++ b/src/tablib/formats/_rst.py @@ -5,7 +5,6 @@ from statistics import median from textwrap import TextWrapper - title = 'rst' extensions = ('rst',) diff --git a/src/tablib/formats/_tsv.py b/src/tablib/formats/_tsv.py index 380b4e64..cdc85bd5 100644 --- a/src/tablib/formats/_tsv.py +++ b/src/tablib/formats/_tsv.py @@ -1,11 +1,9 @@ """ Tablib - TSV (Tab Separated Values) Support. """ -from tablib.formats._csv import ( - export_set as export_set_wrapper, - import_set as import_set_wrapper, - detect as detect_wrapper, -) +from tablib.formats._csv import detect as detect_wrapper +from tablib.formats._csv import export_set as export_set_wrapper +from tablib.formats._csv import import_set as import_set_wrapper title = 'tsv' extensions = ('tsv',) diff --git a/src/tablib/formats/_xls.py b/src/tablib/formats/_xls.py index 3fc94aff..d405c775 100644 --- a/src/tablib/formats/_xls.py +++ b/src/tablib/formats/_xls.py @@ -3,10 +3,11 @@ from io import BytesIO -import tablib import xlrd import xlwt +import tablib + title = 'xls' extensions = ('xls',) diff --git a/src/tablib/formats/_xlsx.py b/src/tablib/formats/_xlsx.py index 6ac46b97..6774ef1c 100644 --- a/src/tablib/formats/_xlsx.py +++ b/src/tablib/formats/_xlsx.py @@ -4,6 +4,7 @@ from io import BytesIO import openpyxl + import tablib Workbook = openpyxl.workbook.Workbook diff --git a/src/tablib/formats/_yaml.py b/src/tablib/formats/_yaml.py index 37078768..54b635ec 100644 --- a/src/tablib/formats/_yaml.py +++ b/src/tablib/formats/_yaml.py @@ -1,9 +1,10 @@ """ Tablib - YAML Support. """ -import tablib import yaml +import tablib + title = 'yaml' extensions = ('yaml', 'yml') diff --git a/src/tablib/packages/dbfpy/dbf.py b/src/tablib/packages/dbfpy/dbf.py index cd9999dd..dd38c9c3 100644 --- a/src/tablib/packages/dbfpy/dbf.py +++ b/src/tablib/packages/dbfpy/dbf.py @@ -62,8 +62,7 @@ __all__ = ["Dbf"] -from . import header -from . import record +from . import header, record from .utils import INVALID_VALUE diff --git a/src/tablib/packages/dbfpy/header.py b/src/tablib/packages/dbfpy/header.py index 05db8800..e4074271 100644 --- a/src/tablib/packages/dbfpy/header.py +++ b/src/tablib/packages/dbfpy/header.py @@ -19,8 +19,8 @@ __all__ = ["DbfHeader"] -import io import datetime +import io import struct import sys diff --git a/src/tablib/packages/dbfpy/record.py b/src/tablib/packages/dbfpy/record.py index db79e865..86830b98 100644 --- a/src/tablib/packages/dbfpy/record.py +++ b/src/tablib/packages/dbfpy/record.py @@ -20,6 +20,7 @@ from . import utils + class DbfRecord: """DBF record. diff --git a/tests/test_tablib.py b/tests/test_tablib.py index 5464a8d9..2f37fdb1 100755 --- a/tests/test_tablib.py +++ b/tests/test_tablib.py @@ -9,6 +9,7 @@ from uuid import uuid4 from MarkupPy import markup + import tablib from tablib.core import Row, detect_format from tablib.formats import _csv as csv_module diff --git a/tox.ini b/tox.ini index c3eaa2a5..ab712daa 100644 --- a/tox.ini +++ b/tox.ini @@ -24,11 +24,12 @@ basepython = python3.7 deps = flake8 # flake8-black - # flake8-isort + isort twine check-manifest commands = # flake8 src/tablib tests/ + isort --check-only check-manifest -v python setup.py sdist twine check dist/*