biocore / biom-format

The Biological Observation Matrix (BIOM) Format Project
http://biom-format.org
Other
92 stars 95 forks source link

table_summarizer.py DeprecationWarning locale.format --> locale.format_string #908

Closed peterjc closed 1 year ago

peterjc commented 1 year ago

As per https://docs.python.org/3/library/locale.html#locale.format

Deprecated since version 3.7: Use format_string() instead.

Noticed running make on a clear checkout:

biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_default
biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_qualitative
  /Users/pc40583/repositories/biom-format/biom/cli/table_summarizer.py:88: DeprecationWarning: This method will be removed in a future version of Python. Use 'locale.format_string()' instead.
    lines.append('Num samples: ' + locale.format('%d', num_samples,

biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_default
biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_qualitative
  /Users/pc40583/repositories/biom-format/biom/cli/table_summarizer.py:90: DeprecationWarning: This method will be removed in a future version of Python. Use 'locale.format_string()' instead.
    lines.append('Num observations: ' + locale.format('%d',

biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_default
  /Users/pc40583/repositories/biom-format/biom/cli/table_summarizer.py:95: DeprecationWarning: This method will be removed in a future version of Python. Use 'locale.format_string()' instead.
    lines.append('Total count: ' + locale.format('%d', total_count,

biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_default
biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_qualitative
  /Users/pc40583/repositories/biom-format/biom/cli/table_summarizer.py:110: DeprecationWarning: This method will be removed in a future version of Python. Use 'locale.format_string()' instead.
    lines.append(' Min: ' + locale.format('%1.3f', min_counts, grouping=True))

biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_default
biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_qualitative
  /Users/pc40583/repositories/biom-format/biom/cli/table_summarizer.py:111: DeprecationWarning: This method will be removed in a future version of Python. Use 'locale.format_string()' instead.
    lines.append(' Max: ' + locale.format('%1.3f', max_counts, grouping=True))

biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_default
biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_qualitative
  /Users/pc40583/repositories/biom-format/biom/cli/table_summarizer.py:112: DeprecationWarning: This method will be removed in a future version of Python. Use 'locale.format_string()' instead.
    lines.append(' Median: ' + locale.format('%1.3f', median_counts,

biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_default
biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_qualitative
  /Users/pc40583/repositories/biom-format/biom/cli/table_summarizer.py:114: DeprecationWarning: This method will be removed in a future version of Python. Use 'locale.format_string()' instead.
    lines.append(' Mean: ' + locale.format('%1.3f', mean_counts,

biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_default
biom/tests/test_cli/test_summarize_table.py::TestSummarizeTable::test_qualitative
  /Users/pc40583/repositories/biom-format/biom/cli/table_summarizer.py:116: DeprecationWarning: This method will be removed in a future version of Python. Use 'locale.format_string()' instead.
    lines.append(' Std. dev.: ' + locale.format('%1.3f',

biom/tests/test_cli/test_summarize_table.py: 18 warnings
  /Users/pc40583/repositories/biom-format/biom/cli/table_summarizer.py:143: DeprecationWarning: This method will be removed in a future version of Python. Use 'locale.format_string()' instead.
    lines.append('%s: ' % k + locale.format('%1.3f', v, grouping=True))
wasade commented 1 year ago

This is puzzling as I'm running py38 in a current env and do not receive those warnings? That said, I'm certainly +1 on the adjustment