Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def _list_all(self, api_call: Callable, response_key: str, verbose: bool) -> lis
:return: A List of the combined results of the provided API call.
"""
name_collection: list = []
token = DEFAULT_PAGINATION_TOKEN
token: str | None = DEFAULT_PAGINATION_TOKEN

while token is not None:
response = api_call(nextToken=token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def get_openlineage_facets_on_complete(self, _) -> OperatorLineage:
run_facets: dict[str, BaseFacet] = {}
if parse_result.errors:
run_facets["extractionError"] = ExtractionErrorRunFacet(
totalTasks=len(self.query) if isinstance(self.query, list) else 1,
totalTasks=1,
failedTasks=len(parse_result.errors),
errors=[
Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self, *, config: dict, **kwargs):
super().__init__(**kwargs)
self.config = config

def parse_integer(self, config: dict, field: list[str] | str) -> None:
def parse_integer(self, config: dict | list, field: list[str] | str) -> None:
"""Recursive method for parsing string fields holding integer values to integers."""
if len(field) == 1:
if isinstance(config, list):
Expand Down Expand Up @@ -993,7 +993,7 @@ def execute(self, context: Context) -> dict:
)
if response["ResponseMetadata"]["HTTPStatusCode"] != 200:
raise AirflowException(f"Sagemaker Tuning Job creation failed: {response}")

description: dict = {}
if self.deferrable:
self.defer(
trigger=SageMakerTrigger(
Expand All @@ -1009,7 +1009,6 @@ def execute(self, context: Context) -> dict:
else None
),
)
description = {} # never executed but makes static checkers happy
elif self.wait_for_completion:
description = self.hook.check_status(
self.config["HyperParameterTuningJobName"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _fix_dtypes(df: pd.DataFrame, file_format: FILE_FORMAT) -> None:
raise AirflowOptionalProviderFeatureException(e)

for col in df:
if df[col].dtype.name == "object" and file_format == "parquet":
if df[col].dtype.name == "object" and file_format == FILE_FORMAT.PARQUET:
# if the type wasn't identified or converted, change it to a string so if can still be
# processed.
df[col] = df[col].astype(str)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ def test_fix_dtypes(self, params):
s3_key="s3_key",
task_id="task_id",
sql_conn_id="mysql_conn_id",
file_format=params["file_format"],
)
dirty_df = pd.DataFrame({"strings": ["a", "b", None], "ints": [1, 2, None]})
op._fix_dtypes(df=dirty_df, file_format=params["file_format"])
op._fix_dtypes(df=dirty_df, file_format=op.file_format)
assert dirty_df["strings"].values[2] == params["null_string_result"]
assert dirty_df["ints"].dtype.kind == "i"

Expand Down