Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(typing): remove unused ignores #1979

Merged
merged 6 commits into from
Feb 11, 2025
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
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
Loading