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

refactor(python): Use cls (not self) in classmethods #16303

Merged
merged 1 commit into from
May 18, 2024
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
2 changes: 1 addition & 1 deletion py-polars/polars/datatypes/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def is_temporal(cls) -> bool: # noqa: D102
...

@classmethod
def is_nested(self) -> bool: # noqa: D102
def is_nested(cls) -> bool: # noqa: D102
...


Expand Down
8 changes: 4 additions & 4 deletions py-polars/polars/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def _get_buffers(self) -> SeriesBuffers:

@classmethod
def _from_buffer(
self, dtype: PolarsDataType, buffer_info: BufferInfo, owner: Any
cls, dtype: PolarsDataType, buffer_info: BufferInfo, owner: Any
) -> Self:
"""
Construct a Series from information about its underlying buffer.
Expand Down Expand Up @@ -478,11 +478,11 @@ def _from_buffer(
-----
This method is mainly intended for use with the dataframe interchange protocol.
"""
return self._from_pyseries(PySeries._from_buffer(dtype, buffer_info, owner))
return cls._from_pyseries(PySeries._from_buffer(dtype, buffer_info, owner))

@classmethod
def _from_buffers(
self,
cls,
dtype: PolarsDataType,
data: Series | Sequence[Series],
validity: Series | None = None,
Expand Down Expand Up @@ -531,7 +531,7 @@ def _from_buffers(
data = [s._s for s in data]
if validity is not None:
validity = validity._s
return self._from_pyseries(PySeries._from_buffers(dtype, data, validity))
return cls._from_pyseries(PySeries._from_buffers(dtype, data, validity))

@property
def dtype(self) -> DataType:
Expand Down
1 change: 0 additions & 1 deletion py-polars/polars/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
"assert_frame_not_equal",
"assert_series_equal",
"assert_series_not_equal",
"_constants",
]