Skip to content

Commit 2a78406

Browse files
cmgroteclaude
andcommitted
fix: ruff format and remove unused imports in serde contract tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6498e40 commit 2a78406

2 files changed

Lines changed: 41 additions & 21 deletions

File tree

pyatlan_v9/model/typedef.py

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,9 @@ class Options(msgspec.Struct, kw_only=True, rename="camel", omit_defaults=True):
463463
applicable_entity_types: Union[str, None, msgspec.UnsetType] = msgspec.UNSET
464464
"""Set of entities on which this attribute can be applied (JSON-encoded)."""
465465

466-
custom_applicable_entity_types: Union[str, None, msgspec.UnsetType] = msgspec.UNSET
466+
custom_applicable_entity_types: Union[str, None, msgspec.UnsetType] = (
467+
msgspec.UNSET
468+
)
467469
"""Deprecated: see applicable_asset_types, applicable_glossary_types."""
468470

469471
allow_search: Union[bool, None, msgspec.UnsetType] = msgspec.UNSET
@@ -543,8 +545,8 @@ class Options(msgspec.Struct, kw_only=True, rename="camel", omit_defaults=True):
543545
)
544546
"""AI asset type names to restrict the attribute (JSON-encoded)."""
545547

546-
applicable_other_asset_types: Union[str, None, msgspec.UnsetType] = msgspec.field(
547-
default=msgspec.UNSET, name="otherAssetTypeList"
548+
applicable_other_asset_types: Union[str, None, msgspec.UnsetType] = (
549+
msgspec.field(default=msgspec.UNSET, name="otherAssetTypeList")
548550
)
549551
"""Other asset type names to restrict the attribute (JSON-encoded)."""
550552

@@ -661,13 +663,13 @@ def creator(
661663
values_max_count: Union[float, None, msgspec.UnsetType] = msgspec.UNSET
662664
"""Maximum number of values for this attribute."""
663665

664-
index_type_es_config: Union[Dict[str, Any], None, msgspec.UnsetType] = msgspec.field(
665-
default=msgspec.UNSET, name="indexTypeESConfig"
666+
index_type_es_config: Union[Dict[str, Any], None, msgspec.UnsetType] = (
667+
msgspec.field(default=msgspec.UNSET, name="indexTypeESConfig")
666668
)
667669
"""Internal use only."""
668670

669-
index_type_es_fields: Union[Dict[str, Dict[str, str]], None, msgspec.UnsetType] = msgspec.field(
670-
default=msgspec.UNSET, name="indexTypeESFields"
671+
index_type_es_fields: Union[Dict[str, Dict[str, str]], None, msgspec.UnsetType] = (
672+
msgspec.field(default=msgspec.UNSET, name="indexTypeESFields")
671673
)
672674
"""Internal use only."""
673675

@@ -686,7 +688,11 @@ def __post_init__(self):
686688

687689
def _get_option_set(self, attr: str) -> Set[str]:
688690
"""Helper to parse a JSON-encoded set from options."""
689-
val = getattr(self.options, attr, None) if self.options and self.options is not msgspec.UNSET else None
691+
val = (
692+
getattr(self.options, attr, None)
693+
if self.options and self.options is not msgspec.UNSET
694+
else None
695+
)
690696
if val:
691697
return set(json.loads(val))
692698
return set()
@@ -1261,7 +1267,9 @@ class AtlanTagDef(TypeDef, kw_only=True):
12611267
service_type: Union[str, None, msgspec.UnsetType] = msgspec.UNSET
12621268
"""Name used for display purposes."""
12631269

1264-
skip_display_name_uniqueness_check: Union[bool, None, msgspec.UnsetType] = msgspec.UNSET
1270+
skip_display_name_uniqueness_check: Union[bool, None, msgspec.UnsetType] = (
1271+
msgspec.UNSET
1272+
)
12651273
"""TBC"""
12661274

12671275
@staticmethod
@@ -1324,13 +1332,17 @@ class EntityDef(TypeDef, kw_only=True):
13241332
attribute_defs: Union[List[AttributeDef], msgspec.UnsetType] = msgspec.UNSET
13251333
"""Unused."""
13261334

1327-
business_attribute_defs: Union[Dict[str, List[Dict[str, Any]]], None, msgspec.UnsetType] = msgspec.UNSET
1335+
business_attribute_defs: Union[
1336+
Dict[str, List[Dict[str, Any]]], None, msgspec.UnsetType
1337+
] = msgspec.UNSET
13281338
"""Unused."""
13291339

13301340
category: AtlanTypeCategory = AtlanTypeCategory.ENTITY
13311341
"""Type category for entity definitions."""
13321342

1333-
relationship_attribute_defs: Union[List[RelationshipAttributeDef], msgspec.UnsetType] = msgspec.UNSET
1343+
relationship_attribute_defs: Union[
1344+
List[RelationshipAttributeDef], msgspec.UnsetType
1345+
] = msgspec.UNSET
13341346
"""Unused."""
13351347

13361348
service_type: Union[str, None, msgspec.UnsetType] = msgspec.UNSET
@@ -1353,7 +1365,9 @@ def reserved_type(self) -> bool:
13531365
# =============================================================================
13541366

13551367

1356-
class RelationshipEndDef(msgspec.Struct, kw_only=True, rename="camel", omit_defaults=True):
1368+
class RelationshipEndDef(
1369+
msgspec.Struct, kw_only=True, rename="camel", omit_defaults=True
1370+
):
13571371
"""Defines the structure of one end of a relationship.
13581372
13591373
Despite Java's ``RelationshipEndDef extends AttributeDef``, analysis of
@@ -1406,7 +1420,9 @@ class RelationshipDef(TypeDef, kw_only=True):
14061420
propagate_tags: Union[str, None, msgspec.UnsetType] = msgspec.UNSET
14071421
"""Whether Atlan tags propagate through this relationship, and in which direction."""
14081422

1409-
relationship_attribute_defs: Union[List[RelationshipAttributeDef], msgspec.UnsetType] = msgspec.UNSET
1423+
relationship_attribute_defs: Union[
1424+
List[RelationshipAttributeDef], msgspec.UnsetType
1425+
] = msgspec.UNSET
14101426
"""Relationship attributes that can exist for this relationship type."""
14111427

14121428
relationship_category: Union[str, None, msgspec.UnsetType] = msgspec.UNSET

tests_v9/unit/test_v9_typedef_serde_contract.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,15 @@
2828
from __future__ import annotations
2929

3030
import json
31-
from typing import Any, Dict, List
31+
from typing import Any, Dict
3232

3333
import msgspec
3434
import pytest
3535

3636
from pyatlan_v9.model.typedef import (
3737
AttributeDef,
38-
CustomMetadataDef,
39-
EntityDef,
4038
EnumDef,
41-
RelationshipDef,
4239
RelationshipEndDef,
43-
StructDef,
4440
TypeDefResponse,
4541
)
4642

@@ -188,7 +184,9 @@ def test_sparse_attribute_def_does_not_expand_on_reencode(self) -> None:
188184
"""
189185
sparse_source = {"name": "x", "typeName": "string"}
190186
full_payload = _payload(
191-
entityDefs=[{"name": "E", "typeVersion": "1.0", "attributeDefs": [sparse_source]}]
187+
entityDefs=[
188+
{"name": "E", "typeVersion": "1.0", "attributeDefs": [sparse_source]}
189+
]
192190
)
193191
decoded = _decode(full_payload)
194192
re_encoded_attr = _encode(decoded)["entityDefs"][0]["attributeDefs"][0]
@@ -378,7 +376,9 @@ def test_explicit_relationship_category_survives(self) -> None:
378376
)
379377
decoded = _decode(raw)
380378
re_encoded = _encode(decoded)
381-
assert re_encoded["relationshipDefs"][0]["relationshipCategory"] == "COMPOSITION"
379+
assert (
380+
re_encoded["relationshipDefs"][0]["relationshipCategory"] == "COMPOSITION"
381+
)
382382

383383

384384
# ---------------------------------------------------------------------------
@@ -791,7 +791,11 @@ def test_relationship_attribute_defs_present_decode_as_structs(self) -> None:
791791
"endDef1": {"type": "A", "name": "r1", "isContainer": False},
792792
"endDef2": {"type": "B", "name": "r2", "isContainer": False},
793793
"relationshipAttributeDefs": [
794-
{"name": "label", "typeName": "string", "relationshipTypeName": "R"}
794+
{
795+
"name": "label",
796+
"typeName": "string",
797+
"relationshipTypeName": "R",
798+
}
795799
],
796800
}
797801
]

0 commit comments

Comments
 (0)