You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by rs...@apache.org on 2022/02/03 11:01:20 UTC

[avro] branch branch-1.11 updated: Update Styles to Stable Black 22.1.0 (#1489)

This is an automated email from the ASF dual-hosted git repository.

rskraba pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.11 by this push:
     new e67b16b  Update Styles to Stable Black 22.1.0 (#1489)
e67b16b is described below

commit e67b16b516bba54b20662b7fa7423eb8704bcda2
Author: Michael A. Smith <mi...@smith-li.com>
AuthorDate: Mon Jan 31 11:32:22 2022 -0500

    Update Styles to Stable Black 22.1.0 (#1489)
    
    Apply style updates from Black 22.1.0, which is the first stable release of Black. This is necessary to get lang/py passing checks again. No ticket should be needed for this.
---
 lang/py/avro/io.py     |  4 ++--
 lang/py/avro/schema.py | 21 +++++++++------------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/lang/py/avro/io.py b/lang/py/avro/io.py
index 59628b0..cd6a7ae 100644
--- a/lang/py/avro/io.py
+++ b/lang/py/avro/io.py
@@ -514,7 +514,7 @@ class BinaryEncoder:
         size_in_bits = size * 8
         offset_bits = size_in_bits - bits_req
 
-        mask = 2 ** size_in_bits - 1
+        mask = 2**size_in_bits - 1
         bit = 1
         for i in range(bits_req):
             mask ^= bit
@@ -579,7 +579,7 @@ class BinaryEncoder:
         self.write_long(microseconds)
 
     def _timedelta_total_microseconds(self, timedelta_: datetime.timedelta) -> int:
-        return timedelta_.microseconds + (timedelta_.seconds + timedelta_.days * 24 * 3600) * 10 ** 6
+        return timedelta_.microseconds + (timedelta_.seconds + timedelta_.days * 24 * 3600) * 10**6
 
     def write_timestamp_millis_long(self, datum: datetime.datetime) -> None:
         """
diff --git a/lang/py/avro/schema.py b/lang/py/avro/schema.py
index 0793ce6..064c9d1 100644
--- a/lang/py/avro/schema.py
+++ b/lang/py/avro/schema.py
@@ -414,18 +414,15 @@ class PrimitiveSchema(EqualByPropsMixin, Schema):
         @arg writer: the schema to match against
         @return bool
         """
-        return (
-            self.type == writer.type
-            or {
-                "float": self.type == "double",
-                "int": self.type in {"double", "float", "long"},
-                "long": self.type
-                in {
-                    "double",
-                    "float",
-                },
-            }.get(writer.type, False)
-        )
+        return self.type == writer.type or {
+            "float": self.type == "double",
+            "int": self.type in {"double", "float", "long"},
+            "long": self.type
+            in {
+                "double",
+                "float",
+            },
+        }.get(writer.type, False)
 
     def to_json(self, names=None):
         if len(self.props) == 1: