Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit b3341c8

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 64cb781 commit b3341c8

File tree

7 files changed

+21
-9
lines changed

7 files changed

+21
-9
lines changed

python-sdk/src/astro/files/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ def is_pattern(self) -> bool:
114114
"""
115115
return not pathlib.PosixPath(self.path).suffix
116116

117-
def create_from_dataframe(self, df: pd.DataFrame, store_as_dataframe: bool = True, export_options: dict | None = None) -> None:
117+
def create_from_dataframe(
118+
self, df: pd.DataFrame, store_as_dataframe: bool = True, export_options: dict | None = None
119+
) -> None:
118120
"""Create a file in the desired location using the values of a dataframe.
119121
120122
:param store_as_dataframe: Whether the data should later be deserialized as a dataframe or as a file containing

python-sdk/src/astro/files/types/csv.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ def export_to_dataframe(
3838
return PandasDataframe.from_pandas_df(df)
3939

4040
# We need skipcq because it's a method overloading so we don't want to make it a static method
41-
def create_from_dataframe(self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs) -> None: # skipcq PYL-R0201
41+
def create_from_dataframe(
42+
self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs
43+
) -> None: # skipcq PYL-R0201
4244
"""Write csv file to one of the supported locations
4345
4446
:param df: pandas dataframe

python-sdk/src/astro/files/types/excel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def export_to_dataframe(
3737
return PandasDataframe.from_pandas_df(df)
3838

3939
# We need skipcq because it's a method overloading so we don't want to make it a static method
40-
def create_from_dataframe(self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs) -> None: # skipcq PYL-R0201
40+
def create_from_dataframe(
41+
self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs
42+
) -> None: # skipcq PYL-R0201
4143
"""Write Excel file to one of the supported locations
4244
4345
:param df: pandas dataframe

python-sdk/src/astro/files/types/json.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def export_to_dataframe(
4242
return PandasDataframe.from_pandas_df(df)
4343

4444
# We need skipcq because it's a method overloading so we don't want to make it a static method
45-
def create_from_dataframe(self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs) -> None: # skipcq PYL-R0201
45+
def create_from_dataframe(
46+
self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs
47+
) -> None: # skipcq PYL-R0201
4648
"""Write json file to one of the supported locations
4749
4850
:param df: pandas dataframe

python-sdk/src/astro/files/types/ndjson.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def export_to_dataframe(
3939
return PandasDataframe.from_pandas_df(df)
4040

4141
# We need skipcq because it's a method overloading so we don't want to make it a static method
42-
def create_from_dataframe(self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs) -> None: # skipcq PYL-R0201
42+
def create_from_dataframe(
43+
self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs
44+
) -> None: # skipcq PYL-R0201
4345
"""Write ndjson file to one of the supported locations
4446
4547
:param df: pandas dataframe

python-sdk/src/astro/files/types/parquet.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def _convert_remote_file_to_byte_stream(stream) -> io.IOBase:
5757
return remote_obj_buffer
5858

5959
# We need skipcq because it's a method overloading so we don't want to make it a static method
60-
def create_from_dataframe(self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs) -> None: # skipcq PYL-R0201
60+
def create_from_dataframe(
61+
self, df: pd.DataFrame, stream: io.TextIOWrapper, **kwargs
62+
) -> None: # skipcq PYL-R0201
6163
"""Write parquet file to one of the supported locations
6264
6365
:param df: pandas dataframe

python-sdk/src/astro/sql/operators/export_to_file.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import Any
4-
53
import pandas as pd
64
from airflow.decorators.base import get_unique_task_id
75
from airflow.models.xcom_arg import XComArg
@@ -60,7 +58,9 @@ def execute(self, context: Context) -> File: # skipcq PYL-W0613
6058
raise ValueError(f"Expected input_table to be Table or dataframe. Got {type(self.input_data)}")
6159
# Write file if overwrite == True or if file doesn't exist.
6260
if self.if_exists == "replace" or not self.output_file.exists():
63-
self.output_file.create_from_dataframe(df, store_as_dataframe=False, export_options=self.export_options)
61+
self.output_file.create_from_dataframe(
62+
df, store_as_dataframe=False, export_options=self.export_options
63+
)
6464
return self.output_file
6565
else:
6666
raise FileExistsError(f"{self.output_file.path} file already exists.")

0 commit comments

Comments
 (0)