Skip to content

Commit

Permalink
Eliminate dead code in dagster_pipes
Browse files Browse the repository at this point in the history
  • Loading branch information
schrockn committed Sep 29, 2023
1 parent a1325a6 commit 8bb5531
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions python_modules/dagster-pipes/dagster_pipes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
ClassVar,
Dict,
Generic,
Iterable,
Iterator,
Literal,
Mapping,
Expand Down Expand Up @@ -197,14 +196,6 @@ def _assert_defined_partition_property(value: Optional[_T], key: str) -> _T:
)


# This should only be called under the precondition that the current steps targets assets.
def _assert_single_partition(data: PipesContextData, key: str) -> None:
partition_key_range = data["partition_key_range"]
assert partition_key_range is not None
if partition_key_range["start"] != partition_key_range["end"]:
raise DagsterPipesError(f"`{key}` is undefined. Current step targets multiple partitions.")


def _assert_defined_extra(extras: PipesExtras, key: str) -> Any:
if key not in extras:
raise DagsterPipesError(f"Extra `{key}` is undefined. Extras must be provided by user.")
Expand Down Expand Up @@ -253,37 +244,6 @@ def _assert_opt_env_param_type(
return value


def _assert_param_value(value: _T, expected_values: Iterable[_T], method: str, param: str) -> _T:
if value not in expected_values:
raise DagsterPipesError(
f"Invalid value for parameter `{param}` of `{method}`. Expected one of"
f" `{expected_values}`, got `{value}`."
)
return value


def _assert_opt_param_value(
value: _T, expected_values: Sequence[_T], method: str, param: str
) -> _T:
if value is not None and value not in expected_values:
raise DagsterPipesError(
f"Invalid value for parameter `{param}` of `{method}`. Expected one of"
f" `{expected_values}`, got `{value}`."
)
return value


def _assert_param_json_serializable(value: _T, method: str, param: str) -> _T:
try:
json.dumps(value)
except (TypeError, OverflowError):
raise DagsterPipesError(
f"Invalid type for parameter `{param}` of `{method}`. Expected a JSON-serializable"
f" type, got `{type(value)}`."
)
return value


_METADATA_VALUE_KEYS = frozenset(PipesMetadataValue.__annotations__.keys())


Expand Down

0 comments on commit 8bb5531

Please sign in to comment.