Skip to content

Commit 41bd866

Browse files
authored
[SchemaRegistry] avro update docstring (Azure#24364)
1 parent bc9bb07 commit 41bd866

File tree

4 files changed

+14
-18
lines changed

4 files changed

+14
-18
lines changed

sdk/schemaregistry/azure-schemaregistry-avroencoder/azure/schemaregistry/encoder/avroencoder/_exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
class InvalidSchemaError(ValueError):
2929
"""Error during schema validation.
30+
3031
:param str message: The message object stringified as 'message' attribute
3132
:keyword error: The original exception, if any.
3233
@@ -43,6 +44,7 @@ def __init__(self, message, *args, **kwargs):
4344

4445
class InvalidContentError(ValueError):
4546
"""Error during encoding or decoding content with a schema.
47+
4648
:param str message: The message object stringified as 'message' attribute
4749
:keyword error: The original exception, if any.
4850

sdk/schemaregistry/azure-schemaregistry-avroencoder/azure/schemaregistry/encoder/avroencoder/_message_protocol.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ class MessageType(Protocol):
2424
def from_message_content(
2525
cls, content: bytes, content_type: str, **kwargs: Any
2626
) -> "MessageType":
27-
"""
28-
Creates an object that is a subtype of MessageType, given content type and
27+
"""Creates an object that is a subtype of MessageType, given content type and
2928
a content value to be set on the object.
3029
3130
:param bytes content: The content value to be set as the body of the message.
@@ -35,8 +34,7 @@ def from_message_content(
3534
...
3635

3736
def __message_content__(self) -> MessageContent:
38-
"""
39-
A MessageContent object, with `content` and `content_type` set to
37+
"""A MessageContent object, with `content` and `content_type` set to
4038
the values of their respective properties on the MessageType object.
4139
4240
:rtype: ~azure.schemaregistry.encoder.avroencoder.MessageContent

sdk/schemaregistry/azure-schemaregistry-avroencoder/azure/schemaregistry/encoder/avroencoder/_schema_registry_avro_encoder.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@
5959
class AvroEncoder(object):
6060
"""
6161
AvroEncoder provides the ability to encode and decode content according
62-
to the given avro schema. It would automatically register, get and cache the schema.
62+
to the given Avro schema. It would automatically register, get, and cache the schema.
6363
6464
:keyword client: Required. The schema registry client which is used to register schema
6565
and retrieve schema from the service.
6666
:paramtype client: ~azure.schemaregistry.SchemaRegistryClient
67-
:keyword Optional[str] group_name: Required for encoding. Not used for decoding.
67+
:keyword Optional[str] group_name: Required for encoding. Not used when decoding.
6868
Schema group under which schema should be registered.
69-
:keyword bool auto_register: When true, register new schemas passed to encode.
69+
:keyword bool auto_register: When true, registers new schemas passed to encode.
7070
Otherwise, and by default, encode will fail if the schema has not been pre-registered in the registry.
7171
7272
"""
@@ -171,8 +171,7 @@ def encode(
171171
request_options: Optional[Dict[str, Any]] = None,
172172
**kwargs: Any,
173173
) -> Union[MessageType, MessageContent]:
174-
"""
175-
Encode content with the given schema. Create content type value, which consists of the Avro Mime Type string
174+
"""Encode content with the given schema. Create content type value, which consists of the Avro Mime Type string
176175
and the schema ID corresponding to given schema. If provided with a MessageType subtype, encoded content
177176
and content type will be passed to create message object. If not provided, the following dict will be returned:
178177
{"content": Avro encoded value, "content_type": Avro mime type string + schema ID}.
@@ -240,8 +239,7 @@ def decode(
240239
request_options: Dict[str, Any] = None,
241240
**kwargs: Any,
242241
) -> Dict[str, Any]:
243-
"""
244-
Decode bytes content using schema ID in the content type field. `message` must be one of the following:
242+
"""Decode bytes content using schema ID in the content type field. `message` must be one of the following:
245243
1) An object of subtype of the MessageType protocol.
246244
2) A dict {"content": ..., "content_type": ...}, where "content" is bytes and "content_type" is string.
247245
Content must follow format of associated Avro RecordSchema:

sdk/schemaregistry/azure-schemaregistry-avroencoder/azure/schemaregistry/encoder/avroencoder/aio/_schema_registry_avro_encoder_async.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@
4949
class AvroEncoder(object):
5050
"""
5151
AvroEncoder provides the ability to encode and decode content according
52-
to the given avro schema. It would automatically register, get and cache the schema.
52+
to the given avro schema. It would automatically register, get, and cache the schema.
5353
5454
:keyword client: Required. The schema registry client which is used to register schema
5555
and retrieve schema from the service.
5656
:paramtype client: ~azure.schemaregistry.aio.SchemaRegistryClient
57-
:keyword Optional[str] group_name: Required for encoding. Not used for decoding.
57+
:keyword Optional[str] group_name: Required for encoding. Not used when decoding.
5858
Schema group under which schema should be registered.
59-
:keyword bool auto_register: When true, register new schemas passed to encode.
59+
:keyword bool auto_register: When true, registers new schemas passed to encode.
6060
Otherwise, and by default, encode will fail if the schema has not been pre-registered in the registry.
6161
6262
"""
@@ -159,8 +159,7 @@ async def encode(
159159
**kwargs: Any,
160160
) -> Union[MessageType, MessageContent]:
161161

162-
"""
163-
Encode content with the given schema. Create content type value, which consists of the Avro Mime Type string
162+
"""Encode content with the given schema. Create content type value, which consists of the Avro Mime Type string
164163
and the schema ID corresponding to given schema. If provided with a MessageType subtype, encoded content
165164
and content type will be passed to create message object. If not provided, the following dict will be returned:
166165
{"content": Avro encoded value, "content_type": Avro mime type string + schema ID}.
@@ -227,8 +226,7 @@ async def decode(
227226
request_options: Dict[str, Any] = None,
228227
**kwargs: Any,
229228
) -> Dict[str, Any]:
230-
"""
231-
Decode bytes content using schema ID in the content type field. `message` must be one of the following:
229+
"""Decode bytes content using schema ID in the content type field. `message` must be one of the following:
232230
1) A object of subtype of the MessageType protocol.
233231
2) A dict {"content": ..., "content_type": ...}, where "content" is bytes and "content_type" is string.
234232
Content must follow format of associated Avro RecordSchema:

0 commit comments

Comments
 (0)