Skip to content

Commit

Permalink
chore(python): make string_repr private (pola-rs#6636)
Browse files Browse the repository at this point in the history
Co-authored-by: MarcoGorelli <>
  • Loading branch information
MarcoGorelli authored and vincent committed Feb 9, 2023
1 parent cc2aa9e commit c60d2ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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 @@ -2788,9 +2788,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

0 comments on commit c60d2ec

Please sign in to comment.