Skip to content

Commit

Permalink
feature: allow primary argument to add() and is_close() to be a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Jun 18, 2021
1 parent dcd6a88 commit e51a501
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 24 additions & 1 deletion doc/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,64 @@ Latest development release
| Version: 2.13.1
| Released: 2021-02-17

2.14 (2021-06-18)
-----------------
- Allow primary argument of :meth:`Quantity.is_close` and :meth:`Quantity.add`
to be a string.


2.13 (2020-10-13)
-----------------
- Allow currency symbols in compound units (ex: $/oz or lbs/$).


2.12 (2020-07-25)
-----------------
- bug fix release.


2.11 (2020-07-19)
-----------------
- Dropping support for all versions of Python older than 3.5.
- Added *sia* form (ASCII only SI scale factors).
- Added *only_e_notation* argument to :meth:`Quantity.all_from_conv_fmt()`.
- Added :meth:`Quantity.reset_prefs()` method.


2.10 (2020-03-2)
----------------
- Added *negligible*, *tight_units*, *nan*, and *inf* preferences.
- Added *negligible* argument to render.
- Added *infinity_symbol* attribute.
- Changed the return values for :meth:`Quantity.is_nan()` and :meth:`Quantity.is_infinite()`.


2.9 (2020-01-28)
----------------
- Made :meth:`Quantity.extract()` more forgiving.
- Support radix and comma processing when converting strings to :class:`Quantity`.


2.8 (2020-01-08)
----------------
- Fix nit in installer (setup.py).


2.7 (2019-12-17)
----------------
- improve the ability of both :meth:`Quantity.add()` and :meth:`Quantity.scale()` to retain attributes.
- added *accept_binary* preference.
- support all preferences as class attributes.
- allow radix and comma to be replaced by adding *radix* and *comma* preferences.


2.6 (2019-09-24)
----------------
- now support Quantity arguments with :meth:`Quantity.extract()`.
- allow plus and minus signs to be replaced with Unicode equivalents.


2.5 (2019-01-16)
----------------
- added RKM codes example.
Expand All @@ -60,6 +75,7 @@ Latest development release
- reformulated exceptions.
- added support for binary scale factors and :meth:`Quantity.binary()`.


2.4 (2018-09-12)
----------------
- fixed bug in format that resulted in several format codes ignoring width
Expand All @@ -70,6 +86,7 @@ Latest development release
- added concept of equivalent units for unit conversion to documentation.
- enhance UnitConversion so that it supports nonlinear conversions.


2.3 (2018-03-11)
----------------
- enhanced :meth:`Quantity.extract()`
Expand All @@ -89,13 +106,15 @@ Latest development release
* added :meth:`Quantity.format()` method
* support any format specifier supported by Python for floats


2.2 (2017-11-22)
----------------
- added :meth:`Quantity.scale()`
- added :meth:`UnitConversion.convert()`
- added *strip_zeros*
- added no-op conversions (units change but value stays the same, ex: $ → USD)


2.1 (2017-07-30)
----------------
The primary focus of this release was on improving the documentation, though
Expand All @@ -105,6 +124,7 @@ there are a few small feature enhancements.
- added support for non-breaking space as spacer
- removed constraint in :meth:`Quantity.extract()` that names must be identifiers


2.0 (2017-07-15)
----------------
This is a 'coming of age' release where the emphasis shifts from finding the
Expand All @@ -129,11 +149,13 @@ and refinements to the API.
- renamed *strip_dp* option to *strip_radix*
- added *number_fmt* option


1.3 (2017-03-19)
----------------
- reworked constants
- added unit systems for physical constants


1.2 (2017-02-24)
----------------
- allow digits after decimal point to be optional
Expand All @@ -143,12 +165,13 @@ and refinements to the API.
- fix some issues in full precision mode
- ranamed some options, arguments and methods


1.1 (2016-11-27)
----------------
- added *known_units* preference.
- added *get_preference* class method.


1.0 (2016-11-26)
----------------
- initial production release.

2 changes: 2 additions & 0 deletions quantiphy.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ def reset_prefs(cls):
# set preferences {{{3
@classmethod
def set_prefs(cls, **kwargs):
# description {{{4
"""Set class preferences.
Any values not passed in are left alone.
Expand Down Expand Up @@ -1308,6 +1309,7 @@ def set_prefs(cls, **kwargs):
1.2566 uH/m
"""
# code {{{4
cls._initialize_preferences()
if isinstance(kwargs.get('known_units'), str):
kwargs['known_units'] = kwargs['known_units'].split()
Expand Down

0 comments on commit e51a501

Please sign in to comment.