Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions src/confluent_kafka/schema_registry/protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,22 @@

from . import (_MAGIC_BYTE,
reference_subject_name_strategy,
topic_subject_name_strategy,)
topic_subject_name_strategy, )
from .schema_registry_client import (Schema,
SchemaReference)
from confluent_kafka.serialization import SerializationError


# Convert an int to bytes (inverse of ord())
# Python3.chr() -> Unicode
# Python2.chr() -> str(alias for bytes)
if sys.version > '3':
def _bytes(v):
"""
Convert int to bytes

Args:
v (int): The int to convert to bytes.
"""
return bytes((v,))
else:
def _bytes(v):
"""
Convert int to bytes
def _bytes(v):
"""
Convert int to bytes

Args:
v (int): The int to convert to bytes.
"""
return chr(v)
Args:
v (int): The int to convert to bytes.
"""
return bytes((v,))


class _ContextStringIO(io.BytesIO):
Expand Down