Skip to content

Commit 26c9132

Browse files
committed
brought back units with deprecation warning
1 parent 8f72e7a commit 26c9132

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Changed
1616

1717
* Changed `Tolerance` class to no longer use singleton pattern. `Tolerance()` now creates independent instances instead of returning the global `TOL`.
18+
* Renamed `Tolerance.units` to `Tolerance.unit` to better reflect the documented properties. Left `units` with deprecation warning.
1819

1920
### Removed
2021

src/compas/tolerance.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
from contextlib import contextmanager
3636
from decimal import Decimal
37+
from warnings import warn
3738

3839
import compas
3940
from compas.data import Data
@@ -443,6 +444,16 @@ def unit(self, value):
443444
raise ValueError("Invalid unit: {}".format(value))
444445
self._unit = value
445446

447+
@property
448+
def units(self):
449+
warn("The 'units' property is deprecated. Use 'unit' instead.", DeprecationWarning)
450+
return self.unit
451+
452+
@units.setter
453+
def units(self, value):
454+
warn("The 'units' property is deprecated. Use 'unit' instead.", DeprecationWarning)
455+
self.unit = value
456+
446457
@property
447458
def absolute(self):
448459
if not self._absolute:

0 commit comments

Comments
 (0)