Skip to content

Commit 53907c4

Browse files
authored
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`
1 parent d70cdfa commit 53907c4

5 files changed

Lines changed: 13 additions & 21 deletions

File tree

lang/py/avro/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# See the License for the specific language governing permissions and
1818
# limitations under the License.
1919
"""Command line utility for reading and writing Avro files."""
20+
2021
import argparse
2122
import csv
2223
import functools

lang/py/avro/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
"""Contains Constants for Python Avro"""
2121

22-
2322
DATE = "date"
2423
DECIMAL = "decimal"
2524
TIMESTAMP_MICROS = "timestamp-micros"

lang/py/avro/datafile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
2323
https://avro.apache.org/docs/current/spec.html#Object+Container+Files
2424
"""
25+
2526
import io
2627
import json
2728
import warnings

lang/py/avro/name.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# limitations under the License.
1919

2020
"""Contains the Name classes."""
21+
2122
from typing import TYPE_CHECKING, Dict, Optional
2223

2324
from avro.constants import PRIMITIVE_TYPES

lang/py/avro/test/test_schema.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,7 @@ class TestMisc(unittest.TestCase):
745745

746746
def test_correct_recursive_extraction(self):
747747
"""A recursive reference within a schema should be the same type every time."""
748-
s = avro.schema.parse(
749-
"""{
748+
s = avro.schema.parse("""{
750749
"type": "record",
751750
"name": "X",
752751
"fields": [{
@@ -756,8 +755,7 @@ def test_correct_recursive_extraction(self):
756755
"name": "Y",
757756
"fields": [{"name": "Z", "type": "X"}]}
758757
}]
759-
}"""
760-
)
758+
}""")
761759
t = avro.schema.parse(str(s.fields[0].type))
762760
# If we've made it this far, the subschema was reasonably stringified; it ccould be reparsed.
763761
self.assertEqual("X", t.fields[0].type.name)
@@ -1186,12 +1184,10 @@ def test_whitespace(self):
11861184
"""
11871185
Eliminate all whitespace in JSON outside of string literals.
11881186
"""
1189-
s = avro.schema.parse(
1190-
"""{"type": "fixed",
1187+
s = avro.schema.parse("""{"type": "fixed",
11911188
"size": 16,
11921189
"name": "md5"}
1193-
"""
1194-
)
1190+
""")
11951191
self.assertEqual(
11961192
s.canonical_form,
11971193
self.compact_json_string({"name": "md5", "type": "fixed", "size": 16}),
@@ -1270,8 +1266,7 @@ def test_union(self):
12701266
self.assertEqual(s.canonical_form, '["string","null","long"]')
12711267

12721268
def test_large_record_handshake_request(self):
1273-
s = avro.schema.parse(
1274-
"""
1269+
s = avro.schema.parse("""
12751270
{
12761271
"type": "record",
12771272
"name": "HandshakeRequest",
@@ -1289,8 +1284,7 @@ def test_large_record_handshake_request(self):
12891284
}
12901285
]
12911286
}
1292-
"""
1293-
)
1287+
""")
12941288
self.assertEqual(
12951289
s.canonical_form,
12961290
(
@@ -1303,8 +1297,7 @@ def test_large_record_handshake_request(self):
13031297
)
13041298

13051299
def test_large_record_handshake_response(self):
1306-
s = avro.schema.parse(
1307-
"""
1300+
s = avro.schema.parse("""
13081301
{
13091302
"type": "record",
13101303
"name": "HandshakeResponse",
@@ -1327,8 +1320,7 @@ def test_large_record_handshake_response(self):
13271320
"name": "meta",
13281321
"type": ["null", {"type": "map", "values": "bytes"}]}]
13291322
}
1330-
"""
1331-
)
1323+
""")
13321324
self.assertEqual(
13331325
s.canonical_form,
13341326
(
@@ -1343,8 +1335,7 @@ def test_large_record_handshake_response(self):
13431335
)
13441336

13451337
def test_large_record_interop(self):
1346-
s = avro.schema.parse(
1347-
"""
1338+
s = avro.schema.parse("""
13481339
{
13491340
"type": "record",
13501341
"name": "Interop",
@@ -1391,8 +1382,7 @@ def test_large_record_interop(self):
13911382
}
13921383
]
13931384
}
1394-
"""
1395-
)
1385+
""")
13961386
self.assertEqual(
13971387
s.canonical_form,
13981388
(

0 commit comments

Comments
 (0)