From e95c5f08a4ea8548204ebdf8ee40fe9c04f1c8de Mon Sep 17 00:00:00 2001 From: chielP Date: Wed, 18 Oct 2023 11:26:06 +0200 Subject: [PATCH] mypy + fmt --- py-polars/polars/datatypes/classes.py | 5 ++--- py-polars/polars/utils/_construction.py | 9 ++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/py-polars/polars/datatypes/classes.py b/py-polars/polars/datatypes/classes.py index c627badcab7c3..fc9fc439c929d 100644 --- a/py-polars/polars/datatypes/classes.py +++ b/py-polars/polars/datatypes/classes.py @@ -415,9 +415,9 @@ def __repr__(self) -> str: class Categorical(DataType): """A categorical encoding of a set of strings.""" - categories: List[str] | None = None + categories: list[str] | None = None - def __init__(self, categories: List[str] | None = None): + def __init__(self, categories: list[str] | None = None): """ Categorical data type. @@ -430,7 +430,6 @@ def __init__(self, categories: List[str] | None = None): self.categories = categories - class Object(DataType): """Type for wrapping arbitrary Python objects.""" diff --git a/py-polars/polars/utils/_construction.py b/py-polars/polars/utils/_construction.py index 8da598c7d922a..61e35e62352f6 100644 --- a/py-polars/polars/utils/_construction.py +++ b/py-polars/polars/utils/_construction.py @@ -418,7 +418,14 @@ def sequence_to_pyseries( pyseries = _construct_series_with_fallbacks( constructor, name, values, dtype, strict=strict ) - if dtype in (Date, Datetime, Duration, Time, Boolean,Categorical) or isinstance(dtype,Categorical): + if dtype in ( + Date, + Datetime, + Duration, + Time, + Boolean, + Categorical, + ) or isinstance(dtype, Categorical): if pyseries.dtype() != dtype: pyseries = pyseries.cast(dtype, strict=True) return pyseries