run flake8 on pyx files and update tests to also run without cython
ADD
.flake8.cython
+[flake8]
+filename = *.pyx
+ignore = E999,E225
+max-line-length = 90

MODIFY
MANIFEST.in
MANIFEST.in
@@ -3,6 +3,7 @@ include Makefile
include t
include tox.ini
include pytest.ini
+include .flake8.cython
recursive-include conda.recipe *
recursive-include fastavro *.c

MODIFY
fastavro/_reader.pyx
fastavro/_reader.pyx
@@ -56,7 +56,6 @@ AVRO_TYPES = set([
])
-
class ReadError(Exception):
pass
@@ -251,7 +250,9 @@ cpdef read_float(ReaderBase fo, writer_schema=None, reader_schema=None):
data = fo.read(4)
if len(data) == 4:
ch_data[:4] = data
- fi.n = (ch_data[0] | (ch_data[1] << 8) | (ch_data[2] << 16) |
+ fi.n = (ch_data[0] |
+ (ch_data[1] << 8) |
+ (ch_data[2] << 16) |
(ch_data[3] << 24))
return fi.f
else:
@@ -346,7 +347,9 @@ cpdef read_array(ReaderBase fo, writer_schema, reader_schema=None):
if reader_schema:
for i in range(block_count):
- read_items.append(_read_data(fo, writer_schema['items'], reader_schema['items']))
+ read_items.append(_read_data(fo,
+ writer_schema['items'],
+ reader_schema['items']))
else:
for i in range(block_count):
read_items.append(_read_data(fo, writer_schema['items']))
@@ -381,7 +384,9 @@ cpdef read_map(ReaderBase fo, writer_schema, reader_schema=None):
if reader_schema:
for i in range(block_count):
key = read_utf8(fo)
- read_items[key] = _read_data(fo, writer_schema['values'], reader_schema['values'])
+ read_items[key] = _read_data(fo,
+ writer_schema['values'],
+ reader_schema['values'])
else:
for i in range(block_count):
key = read_utf8(fo)

MODIFY
fastavro/_writer.pyx
fastavro/_writer.pyx
@@ -376,8 +376,8 @@ cpdef validate(object datum, schema):
if record_type == 'fixed':
return (
- (isinstance(datum, bytes) and len(datum) == schema['size'])
- or (isinstance(datum, decimal.Decimal))
+ (isinstance(datum, bytes) and len(datum) == schema['size']) or
+ (isinstance(datum, decimal.Decimal))
)
if record_type == 'union':

MODIFY
run-tests.sh
run-tests.sh
@@ -11,6 +11,7 @@ find . -name '*.pyc' -exec rm {} \;
echo "running flake8"
flake8 fastavro tests
+flake8 --config=.flake8.cython fastavro
check-manifest --ignore 'fastavro/_*.c'

run flake8 on pyx files and update tests to also run without cython