0.34.0
0.34.0 (2024-02-04)
Added
- The
Formatter
now exposes theinput_options
andpopulated_options
attributes. Theinput_options
attribute holds anInputOptions
object which stores a record of the input options passed into theFormatter
. Thepopulated_options
attribute returns aPopulatedOptions
object which shows the complete set of populated options which will be used for formatting after merging with the global options. Note that thepopulated_options
attribute is re-calculated each time it is access so that it reflects the current global options. Both theInputOptions
andPopulatedOptions
objects can be used to provide string representations of the options, or provide programmatic access to the options via either attribute access or theas_dict()
methods. [#110] - The
PopulatedOptions
used during formatting of a givenFormattedNumber
instance are stored on that instance for future
reference. - Added
get_default_global_options()
. - Now integer
0
can be passed intoleft_pad_char
to get the same behavior as string"0"
. [#128] - Added tests for docstrings.
Changed
-
[BREAKING] Renamed functions for configuring global options:
set_global_defaults()
->set_global_options()
reset_global_defaults()
->reset_global_options()
GlobalDefaultsContext()
->GlobalOptionsContext()
-
Refactored backend options handling code. Previously,
UserOptions
were rendered intoRenderedOptions
. During rendering the global options were appropriately merged in andsome string literal options were replaced with enums for internal use. These two classes were private. Now there areInputOptions
(which try to faithfully record user input),PopulatedOptions
(which capture the result of merging the global options into the input options, but still using user-friendly string representations of all options), andFinalizedOptions
(which use the internal enum representations ofcertain options). TheInputOptions
andPopulatedOptions
are now public while theFinalizedOptions
is still private to shield the enum representations from the users. This sizable refactor was precipitated by the publicizing of the options. [#110]
Removed
- [BREAKING] Removed
print_global_defaults()
in favor ofget_global_defaults()
which now returns aPopulatedOptions
object which can be printed by the user if desired.
Fixed
- Fixed a bug where
SciNum
formatting resulted instr
objects instead ofFormattedNumber
objects.