Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SchemaRegistry] fix sphinx #35018

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
)

if TYPE_CHECKING:
from azure.schemaregistry import SchemaRegistryClient
import azure.schemaregistry

_LOGGER = logging.getLogger(__name__)

Expand All @@ -75,7 +75,7 @@ class AvroEncoder(object):
def __init__(
self,
*,
client: "SchemaRegistryClient",
client: "azure.schemaregistry.SchemaRegistryClient",
swathipil marked this conversation as resolved.
Show resolved Hide resolved
group_name: Optional[str] = None,
auto_register: bool = False,
**kwargs: Any
Expand Down Expand Up @@ -239,8 +239,9 @@ def decode(
**kwargs: Any,
) -> Dict[str, Any]:
"""Decode bytes content using schema ID in the content type field. `message` must be one of the following:
1) An object of subtype of the MessageType protocol.
2) A dict {"content": ..., "content_type": ...}, where "content" is bytes and "content_type" is string.
1) An object of subtype of the MessageType protocol.
2) A dict {"content": ..., "content_type": ...}, where "content" is bytes and "content_type" is string.

Content must follow format of associated Avro RecordSchema:
https://avro.apache.org/docs/1.10.0/gettingstartedpython.html#Defining+a+schema

Expand All @@ -257,6 +258,7 @@ def decode(
Indicates an issue with validating schemas.
:raises ~azure.schemaregistry.encoder.avroencoder.InvalidContentError:
Indicates an issue with decoding content.

"""
schema_id, content = validate_message(message)
cache_misses = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ async def decode(
"""Decode bytes content using schema ID in the content type field. `message` must be one of the following:
1) A object of subtype of the MessageType protocol.
2) A dict {"content": ..., "content_type": ...}, where "content" is bytes and "content_type" is string.

Content must follow format of associated Avro RecordSchema:
https://avro.apache.org/docs/1.10.0/gettingstartedpython.html#Defining+a+schema

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ mypy = true
pyright = false
type_check_samples = true
verifytypes = true
strict_sphinx = true
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ def encode(
:returns: TypedDict of encoded content and content type if `message_type` is not set, otherwise the
constructed message object.
:rtype: MessageType or MessageContent

"""
...

def decode(
self, # pylint: disable=unused-argument
Expand All @@ -250,11 +252,14 @@ def decode(
Returns the decoded data with the schema format specified by the `content-type` property.
If `validate` callable was passed to constructor, will validate content against schema retrieved
from the registry after decoding.

:param message: The message object which holds the content to be decoded and content type
containing the schema ID.
:type message: MessageType or MessageContent
:keyword request_options: The keyword arguments for http requests to be passed to the client.
:paramtype request_options: dict[str, any] or None
:returns: The decoded content.
:rtype: dict[str, any]

"""
...
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ async def encode(
constructed message object.
:rtype: MessageType or MessageContent
"""
...

async def decode(
self, # pylint: disable=unused-argument
Expand All @@ -190,11 +191,14 @@ async def decode(
Returns the decoded data with the schema format specified by the `content-type` property.
If `validate` callable was passed to constructor, will validate content against schema retrieved
from the registry after decoding.

:param message: The message object which holds the content to be decoded and content type
containing the schema ID.
:type message: MessageType or MessageContent
:keyword request_options: The keyword arguments for http requests to be passed to the client.
:paramtype request_options: dict[str, any] or None
:returns: The decoded content.
:rtype: dict[str, any]

"""
...
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
)

if TYPE_CHECKING:
from ..._schema_registry_client import SchemaRegistryClient
import azure.schemaregistry
from ..._encoder_protocols import MessageContent, SchemaContentValidate

_LOGGER = logging.getLogger(__name__)
Expand All @@ -78,7 +78,7 @@ class JsonSchemaEncoder(object):
def __init__(
self,
*,
client: "SchemaRegistryClient",
client: "azure.schemaregistry.SchemaRegistryClient",
validate: Union[JsonSchemaDraftIdentifier, str, "SchemaContentValidate"],
group_name: Optional[str] = None,
) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from ._async_lru import alru_cache # pylint: disable=import-error

if TYPE_CHECKING:
from ....aio._schema_registry_client_async import SchemaRegistryClient
import azure.schemaregistry.aio
from ...._encoder_protocols import MessageContent, SchemaContentValidate

_LOGGER = logging.getLogger(__name__)
Expand All @@ -56,7 +56,7 @@ class JsonSchemaEncoder(object):

:keyword client: Required. The schema registry client which is used to retrieve schema from the service.
and retrieve schema from the service.
:paramtype client: ~azure.schemaregistry.SchemaRegistryClient
:paramtype client: ~azure.schemaregistry.aio.SchemaRegistryClient
:keyword validate: Required. Used for validation in encode and decode.
If a JsonSchemaDraftIdentifier value or equivalent string is provided, the corresponding validator from
`jsonschema` will be used. In this case, `jsonschema` MUST be installed separately or by installing the
Expand All @@ -71,7 +71,7 @@ class JsonSchemaEncoder(object):
def __init__(
self,
*,
client: "SchemaRegistryClient",
client: "azure.schemaregistry.aio.SchemaRegistryClient",
validate: Union[JsonSchemaDraftIdentifier, str, "SchemaContentValidate"],
group_name: Optional[str] = None,
) -> None:
Expand Down
1 change: 1 addition & 0 deletions sdk/schemaregistry/azure-schemaregistry/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ mypy = true
pyright = false
type_check_samples = true
verifytypes = false
strict_sphinx = true
Loading