Skip to content

Commit

Permalink
long format pint serialization (#560)
Browse files Browse the repository at this point in the history
* fix

* change back to long pint notation in asdf

* update CHANGELOG.rst

* update GH action
  • Loading branch information
CagtayFabry authored Sep 27, 2021
1 parent 1ea8be3 commit 33e8f4a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Grep for PR number in CHANGELOG.md
run: grep -P '\[[^\]]*#${{github.event.number}}[,\]]' CHANGELOG.md
- name: Grep for PR number in CHANGELOG.rst
run: grep -P '\[[^\]]*#${{github.event.number}}[,\]]' CHANGELOG.rst
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ changes
`[#504] <https://github.com/BAMWelDX/weldx/pull/504>`__.
- changed the default `pint.Unit` formatting to short notation ``:~``
`[#519] <https://github.com/BAMWelDX/weldx/pull/519>`__.
(the asdf serialization still uses long notation (`[#560] <https://github.com/BAMWelDX/weldx/pull/560>`__))


fixes
~~~~~
Expand Down
2 changes: 1 addition & 1 deletion weldx/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
The quantity class supports lots of physical units and will combine them during
mathematical operations.
For extended details on working with quantities, please see the
`pint documentation <http://https://pint.readthedocs.io/>`_
`pint documentation <https://pint.readthedocs.io/>`_
Examples
--------
Expand Down
3 changes: 2 additions & 1 deletion weldx/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2535,7 +2535,8 @@ def _shape_triangles(
offset :
An offset that will be added to all indices.
closed_mesh :
If `True`, the side faces of the geometry will also be triangulated.
If `True`, the front and back faces of the geometry will also be
triangulated.
Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion weldx/tags/unit/pint_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PintUnitConverter(WeldxConverter):

def to_yaml_tree(self, obj: pint.Unit, tag: str, ctx) -> str:
"""Convert to python dict."""
return f"{obj:~}" # use 'short' formatting for serialization
return f"{obj:.}" # use 'long' (.) formatting for serialization (short = ~)

def from_yaml_tree(self, node: str, tag: str, ctx) -> pint.Unit:
"""Reconstruct from tree."""
Expand Down

0 comments on commit 33e8f4a

Please sign in to comment.