Skip to content

Commit

Permalink
Update to version 0.1.69 [skip-ci]
Browse files Browse the repository at this point in the history
Files changed:
M	pyproject.toml
M	setup.py
M	unitsnet_py/units/density.py
  • Loading branch information
haimkastner committed Dec 6, 2023
1 parent d68482f commit 00d25be
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
90 changes: 90 additions & 0 deletions unitsnet_py/units/density.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class DensityUnits(Enum):
"""

PoundPerCubicYard = 'pound_per_cubic_yard'
"""
"""

TonnePerCubicMillimeter = 'tonne_per_cubic_millimeter'
"""
Expand Down Expand Up @@ -175,6 +180,11 @@ class DensityUnits(Enum):
"""

KilopoundPerCubicYard = 'kilopound_per_cubic_yard'
"""
"""

FemtogramPerLiter = 'femtogram_per_liter'
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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:
"""
Expand Down Expand Up @@ -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:
"""
Expand Down Expand Up @@ -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³"""

Expand Down Expand Up @@ -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"""

Expand Down Expand Up @@ -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³"""

Expand Down Expand Up @@ -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"""

Expand Down

0 comments on commit 00d25be

Please sign in to comment.