Skip to content

Commit

Permalink
Fixed incorrect representation of string values as floating point num…
Browse files Browse the repository at this point in the history
…bers

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
  • Loading branch information
andy-maier committed May 11, 2023
1 parent ba693a5 commit 24a8a4e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Released: not yet

**Bug fixes:**

* Fixed the incorrect representation of string values as floating point numbers
in the table output formats. (issue #391)

**Enhancements:**

**Cleanup:**
Expand Down
12 changes: 8 additions & 4 deletions zhmccli/_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,8 @@ def print_resources_as_table(
click.echo("No resources.")
else:
sorted_table = sorted(table, key=lambda row: row[0])
out_str = tabulate(sorted_table, prop_names, tablefmt=table_format)
out_str = tabulate(sorted_table, prop_names, tablefmt=table_format,
disable_numparse=True)
click.echo(out_str)


Expand Down Expand Up @@ -796,7 +797,8 @@ def print_dicts_as_table(
click.echo("No items.")
else:
sorted_table = sorted(table, key=lambda row: row[0])
out_str = tabulate(sorted_table, prop_names, tablefmt=table_format)
out_str = tabulate(sorted_table, prop_names, tablefmt=table_format,
disable_numparse=True)
click.echo(out_str)


Expand Down Expand Up @@ -827,7 +829,8 @@ def dict_as_table(data, headers, table_format, show_list=None):
if show_list is None or field in show_list:
value = value_as_table(data[field], inner_format)
table.append((field, value))
ret_str = tabulate(table, headers, tablefmt=table_format)
ret_str = tabulate(table, headers, tablefmt=table_format,
disable_numparse=True)
return ret_str


Expand All @@ -851,7 +854,8 @@ def list_as_table(data, table_format):
for value in data:
value = value_as_table(value, inner_format)
table.append((value,))
ret_str = tabulate(table, headers=[], tablefmt=table_format)
ret_str = tabulate(table, headers=[], tablefmt=table_format,
disable_numparse=True)
return ret_str


Expand Down

0 comments on commit 24a8a4e

Please sign in to comment.