Skip to content

Commit

Permalink
chore(typing): remove unused ignores (#1979)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangotbanned authored Feb 11, 2025
1 parent 2d6df36 commit fd8ccac
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions narwhals/_arrow/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _from_native_frame(

@property
def shape(self: Self) -> tuple[int, int]:
return self._native_frame.shape # type: ignore[no-any-return]
return self._native_frame.shape

def __len__(self: Self) -> int:
return len(self._native_frame)
Expand All @@ -149,7 +149,7 @@ def rows(
def rows(self: Self, *, named: bool) -> list[tuple[Any, ...]] | list[dict[str, Any]]:
if not named:
return list(self.iter_rows(named=False, buffer_size=512)) # type: ignore[return-value]
return self._native_frame.to_pylist() # type: ignore[no-any-return]
return self._native_frame.to_pylist()

def iter_rows(
self: Self, *, named: bool, buffer_size: int
Expand Down Expand Up @@ -334,7 +334,7 @@ def estimated_size(self: Self, unit: SizeUnit) -> int | float:

@property
def columns(self: Self) -> list[str]:
return self._native_frame.schema.names # type: ignore[no-any-return]
return self._native_frame.schema.names

def simple_select(self, *column_names: str) -> Self:
return self._from_native_frame(
Expand Down Expand Up @@ -699,8 +699,9 @@ def write_csv(self: Self, file: str | Path | BytesIO | None) -> str | None:
if file is None:
csv_buffer = pa.BufferOutputStream()
pa_csv.write_csv(pa_table, csv_buffer)
return csv_buffer.getvalue().to_pybytes().decode() # type: ignore[no-any-return]
return pa_csv.write_csv(pa_table, file) # type: ignore[no-any-return]
return csv_buffer.getvalue().to_pybytes().decode()
pa_csv.write_csv(pa_table, file)
return None

def is_unique(self: Self) -> ArrowSeries:
from narwhals._arrow.series import ArrowSeries
Expand Down
2 changes: 1 addition & 1 deletion narwhals/_arrow/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def scatter(self: Self, indices: int | Sequence[int], values: Any) -> Self:
return self._from_native_series(result)

def to_list(self: Self) -> list[Any]:
return self._native_series.to_pylist() # type: ignore[no-any-return]
return self._native_series.to_pylist()

def __array__(self: Self, dtype: Any = None, copy: bool | None = None) -> _1DArray:
return self._native_series.__array__(dtype=dtype, copy=copy)
Expand Down
2 changes: 1 addition & 1 deletion narwhals/_duckdb/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def schema(self: Self) -> dict[str, DType]:

@property
def columns(self: Self) -> list[str]:
return self._native_frame.columns # type: ignore[no-any-return]
return self._native_frame.columns

def to_pandas(self: Self) -> pd.DataFrame:
# only if version is v1, keep around for backcompat
Expand Down
6 changes: 3 additions & 3 deletions narwhals/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def to_native_namespace(self: Self) -> ModuleType:
if self is Implementation.PYARROW:
import pyarrow as pa # ignore-banned-import

return pa # type: ignore[no-any-return]
return pa
if self is Implementation.PYSPARK: # pragma: no cover
import pyspark.sql

Expand All @@ -204,12 +204,12 @@ def to_native_namespace(self: Self) -> ModuleType:
if self is Implementation.DASK:
import dask.dataframe # ignore-banned-import

return dask.dataframe # type: ignore[no-any-return]
return dask.dataframe

if self is Implementation.DUCKDB:
import duckdb # ignore-banned-import

return duckdb # type: ignore[no-any-return]
return duckdb
msg = "Not supported Implementation" # pragma: no cover
raise AssertionError(msg)

Expand Down

0 comments on commit fd8ccac

Please sign in to comment.