UnitValues 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unitvalues-0.1.2/src/UnitValues.egg-info → unitvalues-0.1.3}/PKG-INFO +2 -2
- {unitvalues-0.1.2 → unitvalues-0.1.3}/pyproject.toml +3 -3
- {unitvalues-0.1.2 → unitvalues-0.1.3/src/UnitValues.egg-info}/PKG-INFO +2 -2
- {unitvalues-0.1.2 → unitvalues-0.1.3}/src/unitvalue/units.py +31 -21
- {unitvalues-0.1.2 → unitvalues-0.1.3}/LICENSE +0 -0
- {unitvalues-0.1.2 → unitvalues-0.1.3}/README.md +0 -0
- {unitvalues-0.1.2 → unitvalues-0.1.3}/setup.cfg +0 -0
- {unitvalues-0.1.2 → unitvalues-0.1.3}/src/UnitValues.egg-info/SOURCES.txt +0 -0
- {unitvalues-0.1.2 → unitvalues-0.1.3}/src/UnitValues.egg-info/dependency_links.txt +0 -0
- {unitvalues-0.1.2 → unitvalues-0.1.3}/src/UnitValues.egg-info/requires.txt +0 -0
- {unitvalues-0.1.2 → unitvalues-0.1.3}/src/UnitValues.egg-info/top_level.txt +0 -0
- {unitvalues-0.1.2 → unitvalues-0.1.3}/src/unitvalue/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: UnitValues
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: A small package for using units in Python. Allows for computation with dimensioned qauntities and allows you to convert between different units. Do anything you would do with regular floats or integers in Python except now with units. Package is compatible with NumPy, SciPy + Pandas are in the works. I think you'll find this implementation more elegant then most other unit packages.
|
|
5
5
|
Author-email: Brody Howard <brody.howard@mail.utoronto.ca>
|
|
6
6
|
Project-URL: Homepage, https://github.com/BroRocket/unitvalue/
|
|
@@ -8,7 +8,7 @@ Project-URL: Issues, https://github.com/BroRocket/unitvalue/issues
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: numpy>=1.23.2
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "UnitValues"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.3"
|
|
4
4
|
dependencies = [
|
|
5
|
-
"numpy>=1.23.2"
|
|
5
|
+
"numpy >= 1.23.2"
|
|
6
6
|
]
|
|
7
|
-
requires-python = ">=3.
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Brody Howard", email="brody.howard@mail.utoronto.ca" },
|
|
10
10
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: UnitValues
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: A small package for using units in Python. Allows for computation with dimensioned qauntities and allows you to convert between different units. Do anything you would do with regular floats or integers in Python except now with units. Package is compatible with NumPy, SciPy + Pandas are in the works. I think you'll find this implementation more elegant then most other unit packages.
|
|
5
5
|
Author-email: Brody Howard <brody.howard@mail.utoronto.ca>
|
|
6
6
|
Project-URL: Homepage, https://github.com/BroRocket/unitvalue/
|
|
@@ -8,7 +8,7 @@ Project-URL: Issues, https://github.com/BroRocket/unitvalue/issues
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: numpy>=1.23.2
|
|
@@ -6,7 +6,7 @@ Typically used units are supported and more can be added upon request or in your
|
|
|
6
6
|
import warnings
|
|
7
7
|
import numpy as np
|
|
8
8
|
|
|
9
|
-
class UnitValue:
|
|
9
|
+
class UnitValue: # add specific heat
|
|
10
10
|
"""
|
|
11
11
|
Represents a value with dimension/units.
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ class UnitValue:
|
|
|
26
26
|
"AREA": {"in^2": 0.00064516, "mi^2": 2590000, "yd^2": 0.836127, "ft^2": 0.092903},
|
|
27
27
|
"TEMPERATURE": {"f": None, "R":None},
|
|
28
28
|
"MASS FLOW RATE": {"lb/s": 0.453592, "ton/s": 907.1847, "st/s": 6.35029, "oz": 0.0283495, "lb/min": 0.00755987},
|
|
29
|
-
"ENERGY": {"ftlb": 1.35582, "kcal": 4184, "cal": 4.184},
|
|
29
|
+
"ENERGY": {"BTU": 1055.05585, "ftlb": 1.35582, "kcal": 4184, "cal": 4.184},
|
|
30
30
|
"TIME": {"s": 1, "h": 3600, "min": 60, "ms": 0.001},
|
|
31
31
|
"MOMENTUM": {"slugft/s": 4.449670915354, "lbft/s": 0.1383},
|
|
32
32
|
"FREQUENCY": {"rpm": 0.016667},
|
|
@@ -35,10 +35,11 @@ class UnitValue:
|
|
|
35
35
|
"ENERGY PER UNIT MASS": {"ft^2/s^2": 0.09290304},
|
|
36
36
|
"MASS PER UNIT LENGTH": {"lb/ft": 1.48816, "oz/in": 1.11612},
|
|
37
37
|
"MASS PER AREA": {"lb/ft^2": 4.88243},
|
|
38
|
-
"VOLUMETRIC FLOW RATE": {"ft^3/s": 0.0283168, "gal/s": 0.00378541},
|
|
38
|
+
"VOLUMETRIC FLOW RATE": {"ft^3/s": 0.0283168, "gal/s": 0.00378541, "ft^3/min": 0.000471947},
|
|
39
39
|
"DYNAMIC VISCOCITY": {"lb/fts": 1.488163943568},
|
|
40
40
|
"KINEMATIC VISCOCITY": {"ft^2/s": 0.092903},
|
|
41
|
-
"MASS FLUX": {"lb/ft^2s": 4.88243}
|
|
41
|
+
"MASS FLUX": {"lb/ft^2s": 4.88243},
|
|
42
|
+
"SPECIFIC HEAT": {"BTU/lbf": 4186.8000000087}
|
|
42
43
|
},
|
|
43
44
|
"METRIC": {
|
|
44
45
|
"DISTANCE": {"m": 1, "km": 1000, "cm": 0.01, "mm": 0.001},
|
|
@@ -62,11 +63,12 @@ class UnitValue:
|
|
|
62
63
|
"VOLUMETRIC FLOW RATE": {"m^3/s": 1, "cm^3/s": 0.000001},
|
|
63
64
|
"DYNAMIC VISCOCITY": {"kg/ms": 1, "g/cms":0.1},
|
|
64
65
|
"KINEMATIC VISCOCITY": {"m^2/s": 1, "cm^2/s": 0.0001},
|
|
65
|
-
"MASS FLUX": {"kg/m^2s": 1}
|
|
66
|
+
"MASS FLUX": {"kg/m^2s": 1},
|
|
67
|
+
"SPECIFIC HEAT": {"m^2/s^2K": 1, "J/kgK": 1, "J/kgc": 1}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
SPELLING_MAP = {'mtr': 'm', 'meters': 'm', 'mtr.': 'm', 'metres': 'm', 'metre': 'm', 'm ': 'm', 'meter': 'm', 'kilometer': 'km', 'kilometre': 'km', 'kilo meter': 'km', 'k meter': 'km', 'klometer': 'km', 'km ': 'km', 'kmeter': 'km', 'kmtr': 'km', 'centemeter': 'cm', 'centimetre': 'cm', 'cn': 'cm', 'c meter': 'cm', 'cm ': 'cm', 'centi meter': 'cm', 'centimeter': 'cm', 'cmeter': 'cm', 'cmtr': 'cm', 'mmeter': 'mm', 'millimeter': 'mm', 'milimeter': 'mm', 'milli meter': 'mm', 'millimetre': 'mm', 'm meter': 'mm', 'mn': 'mm', 'mmtr': 'mm', 'mm ': 'mm', 'g ': 'g', 'gramme': 'g', 'grm': 'g', 'gms': 'g', 'gram': 'g', 'gm': 'g', 'gramm': 'g', 'gram ': 'g', 'kilograms': 'kg', 'k gram': 'kg', 'kilogramme': 'kg', 'kilogram ': 'kg', 'kilogramme ': 'kg', 'kilogrammes': 'kg', 'kg ': 'kg', 'kilogram': 'kg', 'kilo gram': 'kg', 'kgrm': 'kg', 'liters': 'L', 'l': 'L', 'litres': 'L', 'ltrs': 'L', 'liter': 'L', 'litre ': 'L', 'litre': 'L', 'liters ': 'L', 'liter ': 'L', 'litter': 'L', 'ltr': 'L', 'ml': 'mL', 'milliliter': 'mL', 'mlitres': 'mL', 'millilitre': 'mL', 'milli litre': 'mL', 'mliters': 'mL', 'milli liter': 'mL', 'mltr': 'mL', 'sec': 's', 'seconds': 's', 'sedonds': 's', 'sconds': 's', 'second': 's', 'secs': 's', 'secnd': 's', 'minute': 'min', 'minuts': 'min', 'mins': 'min', 'minutes': 'min', 'min': 'min', 'minut': 'min', 'hours': 'h', 'hr': 'h', 'howr': 'h', 'houer': 'h', 'hour': 'h', 'hou': 'h', 'hrs': 'h', 'square meters': 'm^2', 'square meter': 'm^2', 'sqr meter': 'm^2', 'square metre': 'm^2', 'sq meter': 'm^2', 'sqmetre': 'm^2', 'sq metres': 'm^2', 'sqm': 'm^2', 'cube meter': 'm^3', 'cu meter': 'm^3', 'cbm': 'm^3', 'cubic meters': 'm^3', 'cubic metre': 'm^3', 'cubic meter': 'm^3', 'cu m': 'm^3', 'degree centigrade': 'c', 'degree celsius': 'c', 'celcius': 'c', 'deg celsius': 'c', 'celsius degree': 'c', 'celsus': 'c', 'celsius': 'c', 'deg c': 'c', 'fahrenheit degree': 'f', 'deg f': 'f', 'deg fahrenheit': 'f', 'fahrenhiet': 'f', 'degree fahrenheit': 'f', 'farhenheit': 'f', 'force': 'kgm/s^2', 'Newton': 'kgm/s^2', 'newtn': 'kgm/s^2', 'nwton': 'kgm/s^2', 'nwt': 'kgm/s^2', 'newton': 'kgm/s^2', 'joule': 'kgm^2/s^2', 'energy': 'kgm^2/s^2', 'juole': 'kgm^2/s^2', 'jl': 'kgm^2/s^2', 'joules': 'kgm^2/s^2', 'juul': 'kgm^2/s^2', 'inck': 'in', 'inche': 'in', 'inch': 'in', 'inc': 'in', 'inch ': 'in', 'inchh': 'in', 'foot': 'ft', 'foott': 'ft', 'fot': 'ft', 'foor': 'ft', 'foot ': 'ft', 'feet': 'ft', 'yardd': 'yd', 'yad': 'yd', 'yarrd': 'yd', 'yard ': 'yd', 'yard': 'yd', 'mille': 'mi', 'mile ': 'mi', 'milee': 'mi', 'mil': 'mi', 'mile': 'mi', 'pounds': 'lb', 'pounnd': 'lb', 'pound ': 'lb', 'pound': 'lb', 'lbs': 'lb', 'poundd': 'lb', 'galln': 'gal', 'gllon': 'gal', 'gallon': 'gal', 'galllon': 'gal', 'gallon ': 'gal', 'ounze': 'oz', 'ouncce': 'oz', 'ounce ': 'oz', 'ozs': 'oz', 'ounce': 'oz', 'ounc': 'oz', 'ounc ': 'oz', 'stn': 'st', 'stone ': 'st', 'sts': 'st', 'stone': 'st', 'st ': 'st', 'ft2': 'ft^2', 'square foot': 'ft^2', 'sqft': 'ft^2', 'square feet': 'ft^2', 'sq foot': 'ft^2', 'ft3': 'ft^3', 'cft': 'ft^3', 'cubic foot': 'ft^3', 'cu ft': 'ft^3', 'cubic feet': 'ft^3'}
|
|
71
|
+
SPELLING_MAP = {'mtr': 'm', 'meters': 'm', 'mtr.': 'm', 'metres': 'm', 'metre': 'm', 'm ': 'm', 'meter': 'm', 'kilometer': 'km', 'kilometre': 'km', 'kilo meter': 'km', 'k meter': 'km', 'klometer': 'km', 'km ': 'km', 'kmeter': 'km', 'kmtr': 'km', 'centemeter': 'cm', 'centimetre': 'cm', 'cn': 'cm', 'c meter': 'cm', 'cm ': 'cm', 'centi meter': 'cm', 'centimeter': 'cm', 'cmeter': 'cm', 'cmtr': 'cm', 'mmeter': 'mm', 'millimeter': 'mm', 'milimeter': 'mm', 'milli meter': 'mm', 'millimetre': 'mm', 'm meter': 'mm', 'mn': 'mm', 'mmtr': 'mm', 'mm ': 'mm', 'g ': 'g', 'gramme': 'g', 'grm': 'g', 'gms': 'g', 'gram': 'g', 'gm': 'g', 'gramm': 'g', 'gram ': 'g', 'kilograms': 'kg', 'k gram': 'kg', 'kilogramme': 'kg', 'kilogram ': 'kg', 'kilogramme ': 'kg', 'kilogrammes': 'kg', 'kg ': 'kg', 'kilogram': 'kg', 'kilo gram': 'kg', 'kgrm': 'kg', 'liters': 'L', 'l': 'L', 'litres': 'L', 'ltrs': 'L', 'liter': 'L', 'litre ': 'L', 'litre': 'L', 'liters ': 'L', 'liter ': 'L', 'litter': 'L', 'ltr': 'L', 'ml': 'mL', 'milliliter': 'mL', 'mlitres': 'mL', 'millilitre': 'mL', 'milli litre': 'mL', 'mliters': 'mL', 'milli liter': 'mL', 'mltr': 'mL', 'sec': 's', 'seconds': 's', 'sedonds': 's', 'sconds': 's', 'second': 's', 'secs': 's', 'secnd': 's', 'minute': 'min', 'minuts': 'min', 'mins': 'min', 'minutes': 'min', 'min': 'min', 'minut': 'min', 'hours': 'h', 'hr': 'h', 'howr': 'h', 'houer': 'h', 'hour': 'h', 'hou': 'h', 'hrs': 'h', 'square meters': 'm^2', 'square meter': 'm^2', 'sqr meter': 'm^2', 'square metre': 'm^2', 'sq meter': 'm^2', 'sqmetre': 'm^2', 'sq metres': 'm^2', 'sqm': 'm^2', 'cube meter': 'm^3', 'cu meter': 'm^3', 'cbm': 'm^3', 'cubic meters': 'm^3', 'cubic metre': 'm^3', 'cubic meter': 'm^3', 'cu m': 'm^3', 'C': 'c','degree centigrade': 'c', 'degree celsius': 'c', 'celcius': 'c', 'deg celsius': 'c', 'celsius degree': 'c', 'celsus': 'c', 'celsius': 'c', 'deg c': 'c', 'fahrenheit degree': 'f', 'deg f': 'f', 'deg fahrenheit': 'f', 'fahrenhiet': 'f', 'degree fahrenheit': 'f', 'farhenheit': 'f', 'force': 'kgm/s^2', 'Newton': 'kgm/s^2', 'newtn': 'kgm/s^2', 'nwton': 'kgm/s^2', 'nwt': 'kgm/s^2', 'newton': 'kgm/s^2', 'joule': 'kgm^2/s^2', 'energy': 'kgm^2/s^2', 'juole': 'kgm^2/s^2', 'jl': 'kgm^2/s^2', 'joules': 'kgm^2/s^2', 'juul': 'kgm^2/s^2', 'inck': 'in', 'inche': 'in', 'inch': 'in', 'inc': 'in', 'inch ': 'in', 'inchh': 'in', 'foot': 'ft', 'foott': 'ft', 'fot': 'ft', 'foor': 'ft', 'foot ': 'ft', 'feet': 'ft', 'yardd': 'yd', 'yad': 'yd', 'yarrd': 'yd', 'yard ': 'yd', 'yard': 'yd', 'mille': 'mi', 'mile ': 'mi', 'milee': 'mi', 'mil': 'mi', 'mile': 'mi', 'pounds': 'lb', 'pounnd': 'lb', 'pound ': 'lb', 'pound': 'lb', 'lbs': 'lb', 'poundd': 'lb', 'galln': 'gal', 'gllon': 'gal', 'gallon': 'gal', 'galllon': 'gal', 'gallon ': 'gal', 'ounze': 'oz', 'ouncce': 'oz', 'ounce ': 'oz', 'ozs': 'oz', 'ounce': 'oz', 'ounc': 'oz', 'ounc ': 'oz', 'stn': 'st', 'stone ': 'st', 'sts': 'st', 'stone': 'st', 'st ': 'st', 'ft2': 'ft^2', 'square foot': 'ft^2', 'sqft': 'ft^2', 'square feet': 'ft^2', 'sq foot': 'ft^2', 'ft3': 'ft^3', 'cft': 'ft^3', 'cubic foot': 'ft^3', 'cu ft': 'ft^3', 'cubic feet': 'ft^3'}
|
|
70
72
|
|
|
71
73
|
@classmethod
|
|
72
74
|
def add_custom_unit(cls, system: str, dimension:str, unit:str, conversion_factor: float) -> None:
|
|
@@ -558,8 +560,8 @@ class UnitValue:
|
|
|
558
560
|
Checks if UnitValue object is equal to other.
|
|
559
561
|
"""
|
|
560
562
|
if isinstance(other, UnitValue):
|
|
561
|
-
a = self.
|
|
562
|
-
b = other.
|
|
563
|
+
a = self.copy().convert_base_metric()
|
|
564
|
+
b = other.copy().convert_base_metric()
|
|
563
565
|
return a.value == b.value and a.__unit == b.__unit
|
|
564
566
|
elif isinstance(other, (int, float)):
|
|
565
567
|
return self.value == other
|
|
@@ -567,8 +569,8 @@ class UnitValue:
|
|
|
567
569
|
|
|
568
570
|
def __ne__(self, other) -> bool:
|
|
569
571
|
if isinstance(other, UnitValue):
|
|
570
|
-
a = self.
|
|
571
|
-
b = other.
|
|
572
|
+
a = self.copy().convert_base_metric()
|
|
573
|
+
b = other.copy().convert_base_metric()
|
|
572
574
|
return a.value != b.value and a.__unit != b.__unit
|
|
573
575
|
elif isinstance(other, (int, float)):
|
|
574
576
|
return self.value != other
|
|
@@ -576,8 +578,8 @@ class UnitValue:
|
|
|
576
578
|
|
|
577
579
|
def __lt__(self, other) -> bool:
|
|
578
580
|
if isinstance(other, UnitValue):
|
|
579
|
-
a = self.
|
|
580
|
-
b = other.
|
|
581
|
+
a = self.copy().convert_base_metric()
|
|
582
|
+
b = other.copy().convert_base_metric()
|
|
581
583
|
return a.value < b.value
|
|
582
584
|
elif isinstance(other, (int, float)):
|
|
583
585
|
return self.value < other
|
|
@@ -585,8 +587,8 @@ class UnitValue:
|
|
|
585
587
|
|
|
586
588
|
def __le__(self, other) -> bool:
|
|
587
589
|
if isinstance(other, UnitValue):
|
|
588
|
-
a = self.
|
|
589
|
-
b = other.
|
|
590
|
+
a = self.copy().convert_base_metric()
|
|
591
|
+
b = other.copy().convert_base_metric()
|
|
590
592
|
return a.value <= b.value
|
|
591
593
|
elif isinstance(other, (int, float)):
|
|
592
594
|
return self.value <= other
|
|
@@ -594,8 +596,8 @@ class UnitValue:
|
|
|
594
596
|
|
|
595
597
|
def __gt__(self, other) -> bool:
|
|
596
598
|
if isinstance(other, UnitValue):
|
|
597
|
-
a = self.
|
|
598
|
-
b = other.
|
|
599
|
+
a = self.copy().convert_base_metric()
|
|
600
|
+
b = other.copy().convert_base_metric()
|
|
599
601
|
return a.value > b.value
|
|
600
602
|
elif isinstance(other, (int, float)):
|
|
601
603
|
return self.value > other
|
|
@@ -603,8 +605,8 @@ class UnitValue:
|
|
|
603
605
|
|
|
604
606
|
def __ge__(self, other) -> bool:
|
|
605
607
|
if isinstance(other, UnitValue):
|
|
606
|
-
a = self.
|
|
607
|
-
b = other.
|
|
608
|
+
a = self.copy().convert_base_metric()
|
|
609
|
+
b = other.copy().convert_base_metric()
|
|
608
610
|
return a.value >= b.value
|
|
609
611
|
elif isinstance(other, (int, float)):
|
|
610
612
|
return self.value >= other
|
|
@@ -641,12 +643,14 @@ class UnitValue:
|
|
|
641
643
|
for ind, element in enumerate(inputs[0]):
|
|
642
644
|
inputs[0][ind] = ufunc(element, inputs[1], **kwargs)
|
|
643
645
|
return inputs[0]
|
|
644
|
-
elif isinstance(inputs[1], np.ndarray):
|
|
646
|
+
elif len(inputs) > 1 and isinstance(inputs[1], np.ndarray):
|
|
645
647
|
inputs = [inputs[0], inputs[1]]
|
|
646
648
|
for ind, element in enumerate(inputs[1]):
|
|
647
649
|
inputs[1][ind] = ufunc(inputs[0], element, **kwargs)
|
|
648
650
|
return inputs[1]
|
|
649
651
|
else:
|
|
652
|
+
if isinstance(inputs[0], (np.float64, np.int64)):
|
|
653
|
+
inputs = [float(inputs[0]), inputs[1]]
|
|
650
654
|
if ufunc == np.add:
|
|
651
655
|
return inputs[0] + inputs[1]
|
|
652
656
|
elif ufunc == np.subtract:
|
|
@@ -655,10 +659,16 @@ class UnitValue:
|
|
|
655
659
|
return inputs[0] * inputs[1]
|
|
656
660
|
elif ufunc == np.divide:
|
|
657
661
|
return inputs[0] / inputs[1]
|
|
662
|
+
elif ufunc == np.sqrt:
|
|
663
|
+
return inputs[0] ** 0.5
|
|
658
664
|
elif ufunc == np.power:
|
|
659
665
|
return inputs[0] ** inputs[1]
|
|
660
666
|
elif ufunc == np.mod:
|
|
661
667
|
return inputs[0] % inputs[1]
|
|
668
|
+
elif ufunc == np.log10:
|
|
669
|
+
return np.log10(inputs[0].value)
|
|
670
|
+
else:
|
|
671
|
+
return NotImplemented
|
|
662
672
|
|
|
663
673
|
def __array_function__(self, func, types, *args, **kwargs):
|
|
664
674
|
if func is np.concatenate:
|
|
@@ -701,7 +711,7 @@ class UnitValue:
|
|
|
701
711
|
else:
|
|
702
712
|
raise Exception(f"Unit {unit} invalid: Unit must be {list(UnitValue.UNITS[self.__system][self.__dimension].keys())} for {self.__system} {self.__dimension}")
|
|
703
713
|
|
|
704
|
-
def
|
|
714
|
+
def copy(self) -> 'UnitValue':
|
|
705
715
|
return UnitValue(self.__system, self.__dimension, self.__unit, self.value)
|
|
706
716
|
|
|
707
717
|
def __temperature_handler(self, old_unit: str, new_unit: str): # add Rankine
|
|
@@ -837,4 +847,4 @@ class UnitValue:
|
|
|
837
847
|
@property
|
|
838
848
|
def get_system(self) -> str:
|
|
839
849
|
return self.__system
|
|
840
|
-
|
|
850
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|