From 00d25be003e3b18e5e408b2282238462c015628e Mon Sep 17 00:00:00 2001 From: haimkastner Date: Wed, 6 Dec 2023 05:01:32 +0000 Subject: [PATCH] Update to version 0.1.69 [skip-ci] Files changed: M pyproject.toml M setup.py M unitsnet_py/units/density.py --- pyproject.toml | 2 +- setup.py | 2 +- unitsnet_py/units/density.py | 90 ++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4cf75a6..31e1e0d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "unitsnet_py" -version = "0.1.68" +version = "0.1.69" description = "A better way to hold unit variables and easily convert to the destination unit" repository = "https://github.com/haimkastner/unitsnet-py" authors = ["Haim Kastner "] diff --git a/setup.py b/setup.py index 8f946fa..90a8ce9 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup_kwargs = { 'name': 'unitsnet-py', - 'version': '0.1.68', + 'version': '0.1.69', 'license': 'MIT', 'keywords': 'conversion, units-of-measure, units, quantities, unit-converter, converter, unit, measure, measures, measurement, measurements', 'description': 'A better way to hold unit variables and easily convert to the destination unit', diff --git a/unitsnet_py/units/density.py b/unitsnet_py/units/density.py index fd862cf..5b16711 100644 --- a/unitsnet_py/units/density.py +++ b/unitsnet_py/units/density.py @@ -35,6 +35,11 @@ class DensityUnits(Enum): """ + PoundPerCubicYard = 'pound_per_cubic_yard' + """ + + """ + TonnePerCubicMillimeter = 'tonne_per_cubic_millimeter' """ @@ -175,6 +180,11 @@ class DensityUnits(Enum): """ + KilopoundPerCubicYard = 'kilopound_per_cubic_yard' + """ + + """ + FemtogramPerLiter = 'femtogram_per_liter' """ @@ -306,6 +316,8 @@ def __init__(self, value: float, from_unit: DensityUnits = DensityUnits.Kilogram self.__pounds_per_cubic_foot = None + self.__pounds_per_cubic_yard = None + self.__tonnes_per_cubic_millimeter = None self.__tonnes_per_cubic_centimeter = None @@ -362,6 +374,8 @@ def __init__(self, value: float, from_unit: DensityUnits = DensityUnits.Kilogram self.__kilopounds_per_cubic_foot = None + self.__kilopounds_per_cubic_yard = None + self.__femtograms_per_liter = None self.__picograms_per_liter = None @@ -426,6 +440,9 @@ def __convert_from_base(self, from_unit: DensityUnits) -> float: if from_unit == DensityUnits.PoundPerCubicFoot: return (value * 0.062427961) + if from_unit == DensityUnits.PoundPerCubicYard: + return (value * 1.685554936) + if from_unit == DensityUnits.TonnePerCubicMillimeter: return (value * 1e-12) @@ -510,6 +527,9 @@ def __convert_from_base(self, from_unit: DensityUnits) -> float: if from_unit == DensityUnits.KilopoundPerCubicFoot: return ((value * 0.062427961) / 1000.0) + if from_unit == DensityUnits.KilopoundPerCubicYard: + return ((value * 1.685554936) / 1000.0) + if from_unit == DensityUnits.FemtogramPerLiter: return ((value * 1) / 1e-15) @@ -593,6 +613,9 @@ def __convert_to_base(self, value: float, to_unit: DensityUnits) -> float: if to_unit == DensityUnits.PoundPerCubicFoot: return (value / 0.062427961) + if to_unit == DensityUnits.PoundPerCubicYard: + return (value / 1.685554936) + if to_unit == DensityUnits.TonnePerCubicMillimeter: return (value / 1e-12) @@ -677,6 +700,9 @@ def __convert_to_base(self, value: float, to_unit: DensityUnits) -> float: if to_unit == DensityUnits.KilopoundPerCubicFoot: return ((value / 0.062427961) * 1000.0) + if to_unit == DensityUnits.KilopoundPerCubicYard: + return ((value / 1.685554936) * 1000.0) + if to_unit == DensityUnits.FemtogramPerLiter: return ((value / 1) * 1e-15) @@ -823,6 +849,21 @@ def from_pounds_per_cubic_foot(pounds_per_cubic_foot: float): return Density(pounds_per_cubic_foot, DensityUnits.PoundPerCubicFoot) + @staticmethod + def from_pounds_per_cubic_yard(pounds_per_cubic_yard: float): + """ + Create a new instance of Density from a value in pounds_per_cubic_yard. + + + + :param meters: The Density value in pounds_per_cubic_yard. + :type pounds_per_cubic_yard: float + :return: A new instance of Density. + :rtype: Density + """ + return Density(pounds_per_cubic_yard, DensityUnits.PoundPerCubicYard) + + @staticmethod def from_tonnes_per_cubic_millimeter(tonnes_per_cubic_millimeter: float): """ @@ -1243,6 +1284,21 @@ def from_kilopounds_per_cubic_foot(kilopounds_per_cubic_foot: float): return Density(kilopounds_per_cubic_foot, DensityUnits.KilopoundPerCubicFoot) + @staticmethod + def from_kilopounds_per_cubic_yard(kilopounds_per_cubic_yard: float): + """ + Create a new instance of Density from a value in kilopounds_per_cubic_yard. + + + + :param meters: The Density value in kilopounds_per_cubic_yard. + :type kilopounds_per_cubic_yard: float + :return: A new instance of Density. + :rtype: Density + """ + return Density(kilopounds_per_cubic_yard, DensityUnits.KilopoundPerCubicYard) + + @staticmethod def from_femtograms_per_liter(femtograms_per_liter: float): """ @@ -1613,6 +1669,17 @@ def pounds_per_cubic_foot(self) -> float: return self.__pounds_per_cubic_foot + @property + def pounds_per_cubic_yard(self) -> float: + """ + + """ + if self.__pounds_per_cubic_yard != None: + return self.__pounds_per_cubic_yard + self.__pounds_per_cubic_yard = self.__convert_from_base(DensityUnits.PoundPerCubicYard) + return self.__pounds_per_cubic_yard + + @property def tonnes_per_cubic_millimeter(self) -> float: """ @@ -1921,6 +1988,17 @@ def kilopounds_per_cubic_foot(self) -> float: return self.__kilopounds_per_cubic_foot + @property + def kilopounds_per_cubic_yard(self) -> float: + """ + + """ + if self.__kilopounds_per_cubic_yard != None: + return self.__kilopounds_per_cubic_yard + self.__kilopounds_per_cubic_yard = self.__convert_from_base(DensityUnits.KilopoundPerCubicYard) + return self.__kilopounds_per_cubic_yard + + @property def femtograms_per_liter(self) -> float: """ @@ -2174,6 +2252,9 @@ def to_string(self, unit: DensityUnits = DensityUnits.KilogramPerCubicMeter) -> if unit == DensityUnits.PoundPerCubicFoot: return f"""{self.pounds_per_cubic_foot} lb/ft³""" + if unit == DensityUnits.PoundPerCubicYard: + return f"""{self.pounds_per_cubic_yard} lb/yd³""" + if unit == DensityUnits.TonnePerCubicMillimeter: return f"""{self.tonnes_per_cubic_millimeter} t/mm³""" @@ -2258,6 +2339,9 @@ def to_string(self, unit: DensityUnits = DensityUnits.KilogramPerCubicMeter) -> if unit == DensityUnits.KilopoundPerCubicFoot: return f"""{self.kilopounds_per_cubic_foot} klb/ft³""" + if unit == DensityUnits.KilopoundPerCubicYard: + return f"""{self.kilopounds_per_cubic_yard} klb/yd³""" + if unit == DensityUnits.FemtogramPerLiter: return f"""{self.femtograms_per_liter} fg/L""" @@ -2346,6 +2430,9 @@ def get_unit_abbreviation(self, unit_abbreviation: DensityUnits = DensityUnits.K if unit_abbreviation == DensityUnits.PoundPerCubicFoot: return """lb/ft³""" + if unit_abbreviation == DensityUnits.PoundPerCubicYard: + return """lb/yd³""" + if unit_abbreviation == DensityUnits.TonnePerCubicMillimeter: return """t/mm³""" @@ -2430,6 +2517,9 @@ def get_unit_abbreviation(self, unit_abbreviation: DensityUnits = DensityUnits.K if unit_abbreviation == DensityUnits.KilopoundPerCubicFoot: return """klb/ft³""" + if unit_abbreviation == DensityUnits.KilopoundPerCubicYard: + return """klb/yd³""" + if unit_abbreviation == DensityUnits.FemtogramPerLiter: return """fg/L"""