Skip to content

Commit 940e5e7

Browse files
committed
Fix io.votable by using !s rather than !r in float format
1 parent 34ad02e commit 940e5e7

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎astropy/io/votable/converters.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ def __init__(self, field, config=None, pos=None):
704704
width = field.width
705705

706706
if precision is None:
707-
format_parts = ["{!r:>"]
707+
format_parts = ["{!s:>"]
708708
else:
709709
format_parts = ["{:"]
710710

@@ -772,7 +772,7 @@ def output(self, value, mask):
772772
result = self._output_format.format(value)
773773
if result.startswith("array"):
774774
raise RuntimeError()
775-
if self._output_format[2] == "r" and result.endswith(".0"):
775+
if self._output_format[2] == "s" and result.endswith(".0"):
776776
result = result[:-2]
777777
return result
778778
elif np.isnan(value):
@@ -1052,7 +1052,7 @@ def output(self, value, mask):
10521052
value = self.null
10531053
real = self._output_format.format(float(value.real))
10541054
imag = self._output_format.format(float(value.imag))
1055-
if self._output_format[2] == "r":
1055+
if self._output_format[2] == "s":
10561056
if real.endswith(".0"):
10571057
real = real[:-2]
10581058
if imag.endswith(".0"):

‎astropy/io/votable/tree.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,7 @@ def to_table_column(self, column):
16801680
column.unit = self.unit
16811681
if (
16821682
isinstance(self.converter, converters.FloatingPoint)
1683-
and self.converter.output_format != "{!r:>}"
1683+
and self.converter.output_format != "{!s:>}"
16841684
):
16851685
column.format = self.converter.output_format
16861686
elif isinstance(self.converter, converters.Char):

0 commit comments

Comments
 (0)