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(python): make string_repr private #6636

Merged
merged 3 commits into from
Feb 2, 2023
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
4 changes: 2 additions & 2 deletions py-polars/polars/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class DataTypeClass(type):
def __repr__(cls) -> str:
return cls.__name__

def string_repr(cls) -> str:
def _string_repr(cls) -> str:
return dtype_str_repr(cls)


Expand All @@ -143,7 +143,7 @@ def __new__(cls, *args: Any, **kwargs: Any) -> PolarsDataType: # type: ignore[m
def __reduce__(self) -> Any:
return (_custom_reconstruct, (type(self), object, None), self.__dict__)

def string_repr(self) -> str:
def _string_repr(self) -> str:
return dtype_str_repr(self)


Expand Down
4 changes: 2 additions & 2 deletions py-polars/polars/internals/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2786,9 +2786,9 @@ def glimpse(self: DF) -> str:

def _parse_column(col_name: str, dtype: PolarsDataType) -> tuple[str, str, str]:
dtype_str = (
f"<{DataTypeClass.string_repr(dtype)}>"
f"<{DataTypeClass._string_repr(dtype)}>"
if isinstance(dtype, DataTypeClass)
else f"<{dtype.string_repr()}>"
else f"<{dtype._string_repr()}>"
)
val = self[:max_num_values][col_name].to_list()
val_str = ", ".join(map(str, val))
Expand Down