summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/conf.py13
-rw-r--r--src/tablib/core.py10
-rw-r--r--src/tablib/formats/_html.py2
-rw-r--r--src/tablib/formats/_jira.py8
-rw-r--r--src/tablib/formats/_rst.py2
-rw-r--r--src/tablib/formats/_xlsx.py2
-rw-r--r--src/tablib/packages/dbfpy/dbfnew.py2
-rw-r--r--src/tablib/packages/dbfpy/fields.py2
-rwxr-xr-xtests/test_tablib.py4
9 files changed, 22 insertions, 23 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 5c56c66..8df446e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Tablib documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 5 15:25:21 2010.
@@ -38,8 +37,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-project = u'Tablib'
-copyright = u'2019 Jazzband'
+project = 'Tablib'
+copyright = '2019 Jazzband'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -181,8 +180,8 @@ htmlhelp_basename = 'Tablibdoc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'Tablib.tex', u'Tablib Documentation',
- u'Jazzband', 'manual'),
+ ('index', 'Tablib.tex', 'Tablib Documentation',
+ 'Jazzband', 'manual'),
]
latex_use_modindex = False
@@ -222,6 +221,6 @@ latex_use_parts = True
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'tablib', u'Tablib Documentation',
- [u'Jazzband'], 1)
+ ('index', 'tablib', 'Tablib Documentation',
+ ['Jazzband'], 1)
]
diff --git a/src/tablib/core.py b/src/tablib/core.py
index 23903eb..335927e 100644
--- a/src/tablib/core.py
+++ b/src/tablib/core.py
@@ -264,7 +264,7 @@ class Dataset:
else:
is_valid = (len(col) == self.height) if self.height else True
else:
- is_valid = all((len(x) == self.width for x in self._data))
+ is_valid = all(len(x) == self.width for x in self._data)
if is_valid:
return True
@@ -423,7 +423,7 @@ class Dataset:
export_set, import_set = self._formats.get(format, (None, None))
if not import_set:
- raise UnsupportedFormat('Format {0} cannot be imported.'.format(format))
+ raise UnsupportedFormat('Format {} cannot be imported.'.format(format))
import_set(self, in_stream, **kwargs)
return self
@@ -436,7 +436,7 @@ class Dataset:
"""
export_set, import_set = self._formats.get(format, (None, None))
if not export_set:
- raise UnsupportedFormat('Format {0} cannot be exported.'.format(format))
+ raise UnsupportedFormat('Format {} cannot be exported.'.format(format))
return export_set(self, **kwargs)
@@ -1095,7 +1095,7 @@ class Databook:
export_book, import_book = self._formats.get(format, (None, None))
if not import_book:
- raise UnsupportedFormat('Format {0} cannot be loaded.'.format(format))
+ raise UnsupportedFormat('Format {} cannot be loaded.'.format(format))
import_book(self, in_stream, **kwargs)
return self
@@ -1108,7 +1108,7 @@ class Databook:
"""
export_book, import_book = self._formats.get(format, (None, None))
if not export_book:
- raise UnsupportedFormat('Format {0} cannot be exported.'.format(format))
+ raise UnsupportedFormat('Format {} cannot be exported.'.format(format))
return export_book(self, **kwargs)
diff --git a/src/tablib/formats/_html.py b/src/tablib/formats/_html.py
index bb31128..edf0c0a 100644
--- a/src/tablib/formats/_html.py
+++ b/src/tablib/formats/_html.py
@@ -53,7 +53,7 @@ def export_book(databook):
for i, dset in enumerate(databook._datasets):
title = (dset.title if dset.title else 'Set %s' % (i))
- wrapper.write('<%s>%s</%s>\n' % (BOOK_ENDINGS, title, BOOK_ENDINGS))
+ wrapper.write('<{}>{}</{}>\n'.format(BOOK_ENDINGS, title, BOOK_ENDINGS))
wrapper.write(dset.html)
wrapper.write('\n')
diff --git a/src/tablib/formats/_jira.py b/src/tablib/formats/_jira.py
index 99dbf3e..96efcf7 100644
--- a/src/tablib/formats/_jira.py
+++ b/src/tablib/formats/_jira.py
@@ -19,7 +19,7 @@ def export_set(dataset):
header = _get_header(dataset.headers) if dataset.headers else ''
body = _get_body(dataset)
- return '%s\n%s' % (header, body) if header else body
+ return '{}\n{}'.format(header, body) if header else body
def _get_body(dataset):
@@ -31,6 +31,6 @@ def _get_header(headers):
def _serialize_row(row, delimiter='|'):
- return '%s%s%s' % (delimiter,
- delimiter.join([str(item) if item else ' ' for item in row]),
- delimiter)
+ return '{}{}{}'.format(delimiter,
+ delimiter.join([str(item) if item else ' ' for item in row]),
+ delimiter)
diff --git a/src/tablib/formats/_rst.py b/src/tablib/formats/_rst.py
index 8b5cfa0..8067f73 100644
--- a/src/tablib/formats/_rst.py
+++ b/src/tablib/formats/_rst.py
@@ -34,7 +34,7 @@ def _max_word_len(text):
8
"""
- return max((len(word) for word in text.split())) if text else 0
+ return max(len(word) for word in text.split()) if text else 0
def _get_column_string_lengths(dataset):
diff --git a/src/tablib/formats/_xlsx.py b/src/tablib/formats/_xlsx.py
index 0a947b8..6ac46b9 100644
--- a/src/tablib/formats/_xlsx.py
+++ b/src/tablib/formats/_xlsx.py
@@ -112,7 +112,7 @@ def dset_sheet(dataset, ws, freeze_panes=True):
row_number = i + 1
for j, col in enumerate(row):
col_idx = get_column_letter(j + 1)
- cell = ws['%s%s' % (col_idx, row_number)]
+ cell = ws['{}{}'.format(col_idx, row_number)]
# bold headers
if (row_number == 1) and dataset.headers:
diff --git a/src/tablib/packages/dbfpy/dbfnew.py b/src/tablib/packages/dbfpy/dbfnew.py
index 29c09a1..1562021 100644
--- a/src/tablib/packages/dbfpy/dbfnew.py
+++ b/src/tablib/packages/dbfpy/dbfnew.py
@@ -176,7 +176,7 @@ if __name__ == '__main__':
for i1 in range(len(dbft)):
rec = dbft[i1]
for fldName in dbft.fieldNames:
- print('%s:\t %s' % (fldName, rec[fldName]))
+ print('{}:\t {}'.format(fldName, rec[fldName]))
print()
dbft.close()
diff --git a/src/tablib/packages/dbfpy/fields.py b/src/tablib/packages/dbfpy/fields.py
index c46037b..d6ee84e 100644
--- a/src/tablib/packages/dbfpy/fields.py
+++ b/src/tablib/packages/dbfpy/fields.py
@@ -307,7 +307,7 @@ class DbfLogicalFieldDef(DbfFieldDef):
return False
if value in "YyTt":
return True
- raise ValueError("[%s] Invalid logical value %r" % (self.name, value))
+ raise ValueError("[{}] Invalid logical value {!r}".format(self.name, value))
def encodeValue(self, value):
"""Return a character from the "TF?" set.
diff --git a/tests/test_tablib.py b/tests/test_tablib.py
index 77f2ef6..4318d7d 100755
--- a/tests/test_tablib.py
+++ b/tests/test_tablib.py
@@ -1012,7 +1012,7 @@ class DBFTests(BaseTestCase):
for reg_char, data_char in zip(_dbf, data.dbf):
so_far += chr(data_char)
if reg_char != data_char and index not in [1, 2, 3]:
- raise AssertionError('Failing at char %s: %s vs %s %s' % (
+ raise AssertionError('Failing at char {}: {} vs {} {}'.format(
index, reg_char, data_char, so_far))
index += 1
@@ -1055,7 +1055,7 @@ class DBFTests(BaseTestCase):
# found_so_far += chr(data_char)
if reg_char != data_char and index not in [1, 2, 3]:
raise AssertionError(
- 'Failing at char %s: %s vs %s (found %s)' % (
+ 'Failing at char {}: {} vs {} (found {})'.format(
index, reg_char, data_char, found_so_far))
index += 1