Skip to content
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
7 changes: 7 additions & 0 deletions .chronus/changes/fix-pylint-2025-11-4-3-57-46.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@azure-tools/typespec-python"
---

Fix pylint for _patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import Type
from .._utils.model_base import TYPE_HANDLER_REGISTRY
import geojson
from .._utils.model_base import TYPE_HANDLER_REGISTRY


@TYPE_HANDLER_REGISTRY.register_serializer(geojson.Feature)
def feature_serializer(obj: geojson.Feature) -> dict:
"""Serialize a geojson.Feature to a dict."""
"""Serialize a geojson.Feature to a dict.

:param obj: The geojson.Feature object to serialize.
:type obj: geojson.Feature
:return: The serialized feature as a dictionary.
:rtype: dict
"""
return {
"type": obj.type,
"geometry": {"type": obj.geometry.type, "coordinates": obj.geometry.coordinates},
Expand All @@ -25,7 +31,13 @@ def feature_serializer(obj: geojson.Feature) -> dict:

@TYPE_HANDLER_REGISTRY.register_deserializer(geojson.Feature)
def feature_deserializer(cls: Type[geojson.Feature], data: dict) -> geojson.Feature:
"""Deserialize a dict to a geojson.Feature."""
"""Deserialize a dict to a geojson.Feature.

:param data: The dictionary data to deserialize.
:type data: dict
:return: The deserialized geojson.Feature object.
:rtype: geojson.Feature
"""
return cls(
type=data.get("type"),
geometry=geojson.geometry.Geometry(
Expand Down
Loading