diff --git a/lang/py/avro/__main__.py b/lang/py/avro/__main__.py index 44fda88252b..f1e1499f1f0 100755 --- a/lang/py/avro/__main__.py +++ b/lang/py/avro/__main__.py @@ -17,6 +17,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """Command line utility for reading and writing Avro files.""" + import argparse import csv import functools diff --git a/lang/py/avro/constants.py b/lang/py/avro/constants.py index 6bdf5a9b4b0..cef9e85daf8 100644 --- a/lang/py/avro/constants.py +++ b/lang/py/avro/constants.py @@ -19,7 +19,6 @@ """Contains Constants for Python Avro""" - DATE = "date" DECIMAL = "decimal" TIMESTAMP_MICROS = "timestamp-micros" diff --git a/lang/py/avro/datafile.py b/lang/py/avro/datafile.py index 541fe5376ec..8a5ce7b17f3 100644 --- a/lang/py/avro/datafile.py +++ b/lang/py/avro/datafile.py @@ -22,6 +22,7 @@ https://avro.apache.org/docs/current/spec.html#Object+Container+Files """ + import io import json import warnings diff --git a/lang/py/avro/name.py b/lang/py/avro/name.py index 0d28338de59..898e53a4906 100644 --- a/lang/py/avro/name.py +++ b/lang/py/avro/name.py @@ -18,6 +18,7 @@ # limitations under the License. """Contains the Name classes.""" + from typing import TYPE_CHECKING, Dict, Optional from avro.constants import PRIMITIVE_TYPES diff --git a/lang/py/avro/test/test_schema.py b/lang/py/avro/test/test_schema.py index 85d9f8db839..c8d94811a21 100644 --- a/lang/py/avro/test/test_schema.py +++ b/lang/py/avro/test/test_schema.py @@ -745,8 +745,7 @@ class TestMisc(unittest.TestCase): def test_correct_recursive_extraction(self): """A recursive reference within a schema should be the same type every time.""" - s = avro.schema.parse( - """{ + s = avro.schema.parse("""{ "type": "record", "name": "X", "fields": [{ @@ -756,8 +755,7 @@ def test_correct_recursive_extraction(self): "name": "Y", "fields": [{"name": "Z", "type": "X"}]} }] - }""" - ) + }""") t = avro.schema.parse(str(s.fields[0].type)) # If we've made it this far, the subschema was reasonably stringified; it ccould be reparsed. self.assertEqual("X", t.fields[0].type.name) @@ -1186,12 +1184,10 @@ def test_whitespace(self): """ Eliminate all whitespace in JSON outside of string literals. """ - s = avro.schema.parse( - """{"type": "fixed", + s = avro.schema.parse("""{"type": "fixed", "size": 16, "name": "md5"} - """ - ) + """) self.assertEqual( s.canonical_form, self.compact_json_string({"name": "md5", "type": "fixed", "size": 16}), @@ -1270,8 +1266,7 @@ def test_union(self): self.assertEqual(s.canonical_form, '["string","null","long"]') def test_large_record_handshake_request(self): - s = avro.schema.parse( - """ + s = avro.schema.parse(""" { "type": "record", "name": "HandshakeRequest", @@ -1289,8 +1284,7 @@ def test_large_record_handshake_request(self): } ] } - """ - ) + """) self.assertEqual( s.canonical_form, ( @@ -1303,8 +1297,7 @@ def test_large_record_handshake_request(self): ) def test_large_record_handshake_response(self): - s = avro.schema.parse( - """ + s = avro.schema.parse(""" { "type": "record", "name": "HandshakeResponse", @@ -1327,8 +1320,7 @@ def test_large_record_handshake_response(self): "name": "meta", "type": ["null", {"type": "map", "values": "bytes"}]}] } - """ - ) + """) self.assertEqual( s.canonical_form, ( @@ -1343,8 +1335,7 @@ def test_large_record_handshake_response(self): ) def test_large_record_interop(self): - s = avro.schema.parse( - """ + s = avro.schema.parse(""" { "type": "record", "name": "Interop", @@ -1391,8 +1382,7 @@ def test_large_record_interop(self): } ] } - """ - ) + """) self.assertEqual( s.canonical_form, (