Skip to content

Commit

Permalink
[SchemaRegistry] fix sphinx (Azure#35018)
Browse files Browse the repository at this point in the history
* fix sphinx

* add sphinx check to avroencoder

* remove unnecessary docfiles for azure.schemaregistry to fix sphinx error
  • Loading branch information
swathipil authored Apr 1, 2024
1 parent 4b2eebb commit 6a407d4
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 54 deletions.
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",
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
15 changes: 0 additions & 15 deletions sdk/schemaregistry/azure-schemaregistry-avroencoder/doc/azure.rst

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

0 comments on commit 6a407d4

Please sign in to comment.