This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/main by this push:
new 53907c40bc chore: Format Python code to make its linter happy (#3631)
53907c40bc is described below
commit 53907c40bcc8c0e8cd3fb3060e509b4afd7fc5c1
Author: Martin Grigorov <[email protected]>
AuthorDate: Thu Jan 22 09:18:42 2026 +0200
chore: Format Python code to make its linter happy (#3631)
https://github.com/apache/avro/actions/runs/21238630219/job/61111610761
```
lint: commands[1]> black --check .
would reformat /home/runner/work/avro/avro/lang/py/avro/constants.py
would reformat /home/runner/work/avro/avro/lang/py/avro/__main__.py
would reformat /home/runner/work/avro/avro/lang/py/avro/datafile.py
would reformat /home/runner/work/avro/avro/lang/py/avro/name.py
would reformat /home/runner/work/avro/avro/lang/py/avro/test/test_schema.py
Oh no! 💥 💔 💥
5 files would be reformatted, 36 files would be left unchanged.
lint: exit 1 (2.52 seconds) /home/runner/work/avro/avro/lang/py> black
--check . pid=3003
lint: FAIL code 1 (9.68=setup[6.91]+cmd[0.25,2.52] seconds)
evaluation failed :( (9.71 seconds)
```
Reformatted the code by temporary removing `check` in `black check .` in
tox.ini, running `./build.sh lint`, restore `check`
---
lang/py/avro/__main__.py | 1 +
lang/py/avro/constants.py | 1 -
lang/py/avro/datafile.py | 1 +
lang/py/avro/name.py | 1 +
lang/py/avro/test/test_schema.py | 30 ++++++++++--------------------
5 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/lang/py/avro/__main__.py b/lang/py/avro/__main__.py
index 44fda88252..f1e1499f1f 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 6bdf5a9b4b..cef9e85daf 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 541fe5376e..8a5ce7b17f 100644
--- a/lang/py/avro/datafile.py
+++ b/lang/py/avro/datafile.py
@@ -22,6 +22,7 @@ Read/Write Avro File Object Containers.
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 0d28338de5..898e53a490 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 85d9f8db83..c8d94811a2 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 @@ class TestMisc(unittest.TestCase):
"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 @@ class CanonicalFormTestCase(unittest.TestCase):
"""
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 @@ class CanonicalFormTestCase(unittest.TestCase):
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 @@ class CanonicalFormTestCase(unittest.TestCase):
}
]
}
- """
- )
+ """)
self.assertEqual(
s.canonical_form,
(
@@ -1303,8 +1297,7 @@ class CanonicalFormTestCase(unittest.TestCase):
)
def test_large_record_handshake_response(self):
- s = avro.schema.parse(
- """
+ s = avro.schema.parse("""
{
"type": "record",
"name": "HandshakeResponse",
@@ -1327,8 +1320,7 @@ class CanonicalFormTestCase(unittest.TestCase):
"name": "meta",
"type": ["null", {"type": "map", "values": "bytes"}]}]
}
- """
- )
+ """)
self.assertEqual(
s.canonical_form,
(
@@ -1343,8 +1335,7 @@ class CanonicalFormTestCase(unittest.TestCase):
)
def test_large_record_interop(self):
- s = avro.schema.parse(
- """
+ s = avro.schema.parse("""
{
"type": "record",
"name": "Interop",
@@ -1391,8 +1382,7 @@ class CanonicalFormTestCase(unittest.TestCase):
}
]
}
- """
- )
+ """)
self.assertEqual(
s.canonical_form,
(