Skip to content

Commit 91ef50d

Browse files
authored
remove unused vendored functions (#94)
1 parent 483bea1 commit 91ef50d

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

pint_xarray/formatting.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@
33
import numpy as np
44

55

6-
# vendored from xarray.core.formatting
7-
# https://github.com/pydata/xarray/blob/v0.16.0/xarray/core/formatting.py#L18-216
8-
def pretty_print(x, numchars: int):
9-
"""Given an object `x`, call `str(x)` and format the returned string so
10-
that it is numchars long, padding with trailing spaces or truncating with
11-
ellipses as necessary
12-
"""
13-
s = maybe_truncate(x, numchars)
14-
return s + " " * max(numchars - len(s), 0)
15-
16-
176
# vendored from xarray.core.formatting
187
def maybe_truncate(obj, maxlen=500):
198
s = str(obj)
@@ -22,14 +11,6 @@ def maybe_truncate(obj, maxlen=500):
2211
return s
2312

2413

25-
# vendored from xarray.core.formatting
26-
def wrap_indent(text, start="", length=None):
27-
if length is None:
28-
length = len(start)
29-
indent = "\n" + " " * length
30-
return start + indent.join(x for x in text.splitlines())
31-
32-
3314
# vendored from xarray.core.formatting
3415
def _get_indexer_at_least_n_items(shape, n_desired, from_end):
3516
assert 0 < n_desired <= np.prod(shape)
@@ -80,17 +61,6 @@ def last_n_items(array, n_desired):
8061
return np.asarray(array).flat[-n_desired:]
8162

8263

83-
# vendored from xarray.core.formatting
84-
def last_item(array):
85-
"""Returns the last item of an array in a list or an empty list."""
86-
if array.size == 0:
87-
# work around for https://github.com/numpy/numpy/issues/5195
88-
return []
89-
90-
indexer = (slice(-1, None),) * array.ndim
91-
return np.ravel(np.asarray(array[indexer])).tolist()
92-
93-
9464
# based on xarray.core.formatting.format_item
9565
def format_item(x, quote_strings=True):
9666
"""Returns a succinct summary of an object as a string"""

0 commit comments

Comments
 (0)