Skip to content

Commit

Permalink
Use PEP 526 syntax for variable type annotations (kedro-org#190)
Browse files Browse the repository at this point in the history
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Danny Farah <danny_farah@mckinsey.com>
  • Loading branch information
merelcht authored and dannyrfar committed May 3, 2023
1 parent 99e3a41 commit fdd205c
Show file tree
Hide file tree
Showing 31 changed files with 55 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class BioSequenceDataSet(AbstractDataSet[List, List]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/dask/parquet_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class ParquetDataSet(AbstractDataSet[dd.DataFrame, dd.DataFrame]):
col3: [[int32]]
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {"write_index": False} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {"write_index": False}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/email/message_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class EmailMessageDataSet(
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/geopandas/geojson_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class GeoJSONDataSet(
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS = {"driver": "GeoJSON"}

# pylint: disable=too-many-arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class HoloviewsWriter(AbstractVersionedDataSet[HoloViews, NoReturn]):
"""

DEFAULT_SAVE_ARGS = {"fmt": "png"} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS: Dict[str, Any] = {"fmt": "png"}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/json/json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class JSONDataSet(AbstractVersionedDataSet[Any, Any]):
"""

DEFAULT_SAVE_ARGS = {"indent": 2} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS: Dict[str, Any] = {"indent": 2}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class MatplotlibWriter(
"""

DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/networkx/gml_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class GMLDataSet(AbstractVersionedDataSet[networkx.Graph, networkx.Graph]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/networkx/graphml_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class GraphMLDataSet(AbstractVersionedDataSet[networkx.Graph, networkx.Graph]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/networkx/json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class JSONDataSet(AbstractVersionedDataSet[networkx.Graph, networkx.Graph]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/pandas/csv_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class CSVDataSet(AbstractVersionedDataSet[pd.DataFrame, pd.DataFrame]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {"index": False} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {"index": False}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/pandas/feather_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class FeatherDataSet(AbstractVersionedDataSet[pd.DataFrame, pd.DataFrame]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
6 changes: 3 additions & 3 deletions kedro-datasets/kedro_datasets/pandas/gbq_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class GBQTableDataSet(AbstractDataSet[None, pd.DataFrame]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {"progress_bar": False} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {"progress_bar": False}

# pylint: disable=too-many-arguments
def __init__(
Expand Down Expand Up @@ -203,7 +203,7 @@ class GBQQueryDataSet(AbstractDataSet[None, pd.DataFrame]):
>>>
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/pandas/generic_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class GenericDataSet(AbstractVersionedDataSet[pd.DataFrame, pd.DataFrame]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/pandas/hdf_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class HDFDataSet(AbstractVersionedDataSet[pd.DataFrame, pd.DataFrame]):
# _lock is a class attribute that will be shared across all the instances.
# It is used to make dataset safe for threads.
_lock = Lock()
DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/pandas/json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class JSONDataSet(AbstractVersionedDataSet[pd.DataFrame, pd.DataFrame]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/pandas/parquet_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class ParquetDataSet(AbstractVersionedDataSet[pd.DataFrame, pd.DataFrame]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/pandas/sql_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def __init__( # pylint: disable=too-many-arguments
"provide a SQLAlchemy connection string."
)

default_load_args = {} # type: Dict[str, Any]
default_load_args: Dict[str, Any] = {}

self._load_args = (
{**default_load_args, **load_args}
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/pandas/xml_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class XMLDataSet(AbstractVersionedDataSet[pd.DataFrame, pd.DataFrame]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {"index": False} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {"index": False}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/pickle/pickle_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class PickleDataSet(AbstractVersionedDataSet[Any, Any]):
>>> assert data.equals(reloaded)
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments,too-many-locals
def __init__(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/pillow/image_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ImageDataSet(AbstractVersionedDataSet[Image.Image, Image.Image]):
"""

DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/plotly/json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class JSONDataSet(
>>> assert fig == reloaded
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/polars/csv_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class CSVDataSet(AbstractVersionedDataSet[pl.DataFrame, pl.DataFrame]):
"""

DEFAULT_LOAD_ARGS = {"rechunk": True} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {"rechunk": True}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/redis/redis_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class PickleDataSet(AbstractDataSet[Any, Any]):
"""

DEFAULT_REDIS_URL = os.getenv("REDIS_URL", "redis://127.0.0.1:6379")
DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/snowflake/snowpark_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ class SnowparkTableDataSet(AbstractDataSet):
# for parallelism within a pipeline please consider
# ``ThreadRunner`` instead
_SINGLE_PROCESS = True
DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

def __init__( # pylint: disable=too-many-arguments
self,
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/spark/spark_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ class SparkDataSet(AbstractVersionedDataSet[DataFrame, DataFrame]):
# for parallelism within a Spark pipeline please consider
# ``ThreadRunner`` instead
_SINGLE_PROCESS = True
DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

def __init__( # pylint: disable=too-many-arguments
self,
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/spark/spark_hive_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SparkHiveDataSet(AbstractDataSet[DataFrame, DataFrame]):
>>> reloaded.take(4)
"""

DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint:disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/spark/spark_jdbc_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class SparkJDBCDataSet(AbstractDataSet[DataFrame, DataFrame]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/svmlight/svmlight_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class SVMLightDataSet(AbstractVersionedDataSet[_DI, _DO]):
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class TensorFlowModelDataset(AbstractVersionedDataSet[tf.keras.Model, tf.keras.M
"""

DEFAULT_LOAD_ARGS = {} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS = {"save_format": "tf"} # type: Dict[str, Any]
DEFAULT_LOAD_ARGS: Dict[str, Any] = {}
DEFAULT_SAVE_ARGS: Dict[str, Any] = {"save_format": "tf"}

# pylint: disable=too-many-arguments
def __init__(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/yaml/yaml_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class YAMLDataSet(AbstractVersionedDataSet[Dict, Dict]):
"""

DEFAULT_SAVE_ARGS = {"default_flow_style": False} # type: Dict[str, Any]
DEFAULT_SAVE_ARGS: Dict[str, Any] = {"default_flow_style": False}

# pylint: disable=too-many-arguments
def __init__(
Expand Down

0 comments on commit fdd205c

Please sign in to comment.