Skip to content

Commit 430bfe0

Browse files
refactor(types): use extra_items from PEP 728
1 parent 6cf818d commit 430bfe0

3 files changed

Lines changed: 8 additions & 20 deletions

File tree

‎src/moderation_api/types/author_create_params.py‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Union, Optional
6-
from typing_extensions import Required, TypeAlias, TypedDict
5+
from typing import Optional
6+
from typing_extensions import Required, TypedDict
77

88
__all__ = ["AuthorCreateParams", "Metadata"]
99

@@ -40,7 +40,7 @@ class AuthorCreateParams(TypedDict, total=False):
4040
"""URL of the author's profile picture"""
4141

4242

43-
class MetadataTyped(TypedDict, total=False):
43+
class Metadata(TypedDict, total=False, extra_items=object): # type: ignore[call-arg]
4444
"""Additional metadata provided by your system.
4545
4646
We recommend including any relevant information that may assist in the moderation process.
@@ -57,6 +57,3 @@ class MetadataTyped(TypedDict, total=False):
5757

5858
phone_verified: Optional[bool]
5959
"""Whether the author's phone number is verified"""
60-
61-
62-
Metadata: TypeAlias = Union[MetadataTyped, Dict[str, object]]

‎src/moderation_api/types/author_update_params.py‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Union, Optional
6-
from typing_extensions import TypeAlias, TypedDict
5+
from typing import Optional
6+
from typing_extensions import TypedDict
77

88
__all__ = ["AuthorUpdateParams", "Metadata"]
99

@@ -37,7 +37,7 @@ class AuthorUpdateParams(TypedDict, total=False):
3737
"""URL of the author's profile picture"""
3838

3939

40-
class MetadataTyped(TypedDict, total=False):
40+
class Metadata(TypedDict, total=False, extra_items=object): # type: ignore[call-arg]
4141
"""Additional metadata provided by your system.
4242
4343
We recommend including any relevant information that may assist in the moderation process.
@@ -54,6 +54,3 @@ class MetadataTyped(TypedDict, total=False):
5454

5555
phone_verified: Optional[bool]
5656
"""Whether the author's phone number is verified"""
57-
58-
59-
Metadata: TypeAlias = Union[MetadataTyped, Dict[str, object]]

‎src/moderation_api/types/content_submit_params.py‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class PolicyCodeAbuse(TypedDict, total=False):
380380
threshold: float
381381

382382

383-
class PolicyPiiMaskingEntitiesTyped(TypedDict, total=False):
383+
class PolicyPiiMaskingEntities(TypedDict, total=False, extra_items=object): # type: ignore[call-arg]
384384
enable: bool
385385

386386
flag: bool
@@ -390,16 +390,13 @@ class PolicyPiiMaskingEntitiesTyped(TypedDict, total=False):
390390
should_mask: Annotated[bool, PropertyInfo(alias="shouldMask")]
391391

392392

393-
PolicyPiiMaskingEntities: TypeAlias = Union[PolicyPiiMaskingEntitiesTyped, Dict[str, object]]
394-
395-
396393
class PolicyPiiMasking(TypedDict, total=False):
397394
id: Required[Literal["pii"]]
398395

399396
entities: Required[Dict[str, PolicyPiiMaskingEntities]]
400397

401398

402-
class PolicyURLMaskingEntitiesTyped(TypedDict, total=False):
399+
class PolicyURLMaskingEntities(TypedDict, total=False, extra_items=object): # type: ignore[call-arg]
403400
enable: bool
404401

405402
flag: bool
@@ -409,9 +406,6 @@ class PolicyURLMaskingEntitiesTyped(TypedDict, total=False):
409406
should_mask: Annotated[bool, PropertyInfo(alias="shouldMask")]
410407

411408

412-
PolicyURLMaskingEntities: TypeAlias = Union[PolicyURLMaskingEntitiesTyped, Dict[str, object]]
413-
414-
415409
class PolicyURLMasking(TypedDict, total=False):
416410
id: Required[Literal["url"]]
417411

0 commit comments

Comments
 (0)