Skip to content

Commit

Permalink
fix: fix mypy failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-W committed Oct 18, 2024
1 parent befff68 commit 044ee6b
Showing 1 changed file with 6 additions and 46 deletions.
52 changes: 6 additions & 46 deletions airflow/assets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,59 +377,19 @@ class Dataset(Asset):

group: str = "dataset"

@overload
def __init__(self, name: str, uri: str, *, extra: dict | None = None) -> None:
"""Canonical; both name and uri are provided."""
super().__init__(name=name, uri=uri, group=Dataset.group, extra=extra)

@overload
def __init__(self, name: str, *, extra: dict | None = None) -> None:
"""It's possible to only provide the name, either by keyword or as the only positional argument."""
super().__init__(name=name, group=Dataset.group, extra=extra)

@overload
def __init__(self, *, uri: str, extra: dict | None = None) -> None:
"""It's possible to only provide the URI as a keyword argument."""
super().__init__(uri=uri, group=Dataset.group, extra=extra)

def __init__(
self,
name: str | None = None,
uri: str | None = None,
*,
extra: dict | None = None,
) -> None:
super().__init__(name=name, uri=uri, group=Dataset.group, extra=extra)
def __init__(self, *args, **kwargs) -> None:
kwargs["group"] = Dataset.group
super().__init__(*args, **kwargs)


class Model(Asset):
"""Subclass of asset."""

group: str = "model"

@overload
def __init__(self, name: str, uri: str, *, extra: dict | None = None) -> None:
"""Canonical; both name and uri are provided."""
super().__init__(name=name, uri=uri, group=Model.group, extra=extra)

@overload
def __init__(self, name: str, *, extra: dict | None = None) -> None:
"""It's possible to only provide the name, either by keyword or as the only positional argument."""
super().__init__(name=name, group=Model.group, extra=extra)

@overload
def __init__(self, *, uri: str, extra: dict | None = None) -> None:
"""It's possible to only provide the URI as a keyword argument."""
super().__init__(uri=uri, group=Model.group, extra=extra)

def __init__(
self,
name: str | None = None,
uri: str | None = None,
*,
extra: dict | None = None,
) -> None:
super().__init__(name=name, uri=uri, group=Model.group, extra=extra)
def __init__(self, *args, **kwargs) -> None:
kwargs["group"] = Model.group
super().__init__(*args, **kwargs)


class _AssetBooleanCondition(BaseAsset):
Expand Down

0 comments on commit 044ee6b

Please sign in to comment.