Skip to content

Commit

Permalink
chore: handle py310 and lower generic typeddict regression
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Jul 21, 2024
1 parent 742ca7d commit fc2ab4d
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/cdf/nextgen/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Definitions for services, sources, and destinations in the workspace."""

import sys
import typing as t
from dataclasses import dataclass, field
from enum import Enum
Expand Down Expand Up @@ -43,14 +44,30 @@ def __call__(self) -> T:
return self.dependency()


class _ComponentProperties(t.TypedDict, t.Generic[T], total=False):
"""A dictionary of properties for component metadata."""
if sys.version_info >= (3, 11):

name: str
dependency: injector.Dependency[T]
owner: str
description: str
sla: ServiceLevelAgreement
class _ComponentProperties(t.TypedDict, t.Generic[T], total=False):
"""A dictionary of properties for component metadata."""

name: str
dependency: injector.Dependency[T]
owner: str
description: str
sla: ServiceLevelAgreement

else:

class _ComponentProperties(t.TypedDict, total=False):
"""A dictionary of properties for component metadata."""

name: str
dependency: injector.Dependency[t.Any]
owner: str
description: str
sla: ServiceLevelAgreement

def __class_getitem__(cls, _):
return cls


Service = Component[t.Any]
Expand Down

0 comments on commit fc2ab4d

Please sign in to comment.