kittycad.models.length_unit.LengthUnit

class kittycad.models.length_unit.LengthUnit(x=0, /)[source][source]

Bases: float

__init__()[source]

Methods

__init__()

as_integer_ratio()

Return a pair of integers, whose ratio is exactly equal to the original float.

conjugate()

Return self, the complex conjugate of any float.

fromhex()

Create a floating-point number from a hexadecimal string.

hex()

Return a hexadecimal representation of a floating-point number.

is_integer()

Return True if the float is an integer.

Attributes

imag

the imaginary part of a complex number

real

the real part of a complex number

__abs__()[source]

abs(self)

__add__(value, /)[source]

Return self+value.

__annotations__ = {}[source]
__bool__()[source]

True if self else False

__ceil__()[source]

Return the ceiling as an Integral.

__dict__ = mappingproxy({'__module__': 'kittycad.models.length_unit', '__doc__': '', '__float__': <function LengthUnit.__float__>, '__get_pydantic_core_schema__': <classmethod(<function LengthUnit.__get_pydantic_core_schema__>)>, '__dict__': <attribute '__dict__' of 'LengthUnit' objects>, '__weakref__': <attribute '__weakref__' of 'LengthUnit' objects>, '__annotations__': {}})[source]
__divmod__(value, /)[source]

Return divmod(self, value).

__eq__(value, /)[source]

Return self==value.

__float__()[source][source]

float(self)

Return type:

float

__floor__()[source]

Return the floor as an Integral.

__floordiv__(value, /)[source]

Return self//value.

__format__(format_spec, /)[source]

Formats the float according to format_spec.

__ge__(value, /)[source]

Return self>=value.

classmethod __get_pydantic_core_schema__(source_type, handler)[source][source]
Return type:

Union[AnySchema, NoneSchema, BoolSchema, IntSchema, FloatSchema, DecimalSchema, StringSchema, BytesSchema, DateSchema, TimeSchema, DatetimeSchema, TimedeltaSchema, LiteralSchema, EnumSchema, IsInstanceSchema, IsSubclassSchema, CallableSchema, ListSchema, TupleSchema, SetSchema, FrozenSetSchema, GeneratorSchema, DictSchema, AfterValidatorFunctionSchema, BeforeValidatorFunctionSchema, WrapValidatorFunctionSchema, PlainValidatorFunctionSchema, WithDefaultSchema, NullableSchema, UnionSchema, TaggedUnionSchema, ChainSchema, LaxOrStrictSchema, JsonOrPythonSchema, TypedDictSchema, ModelFieldsSchema, ModelSchema, DataclassArgsSchema, DataclassSchema, ArgumentsSchema, CallSchema, CustomErrorSchema, JsonSchema, UrlSchema, MultiHostUrlSchema, DefinitionsSchema, DefinitionReferenceSchema, UuidSchema, ComplexSchema]

__getformat__()[source]

You probably don’t want to use this function.

typestr

Must be ‘double’ or ‘float’.

It exists mainly to be used in Python’s test suite.

This function returns whichever of ‘unknown’, ‘IEEE, big-endian’ or ‘IEEE, little-endian’ best describes the format of floating-point numbers used by the C type named by typestr.

__getnewargs__()[source]
__gt__(value, /)[source]

Return self>value.

__hash__()[source]

Return hash(self).

__int__()[source]

int(self)

__le__(value, /)[source]

Return self<=value.

__lt__(value, /)[source]

Return self<value.

__mod__(value, /)[source]

Return self%value.

__module__ = 'kittycad.models.length_unit'[source]
__mul__(value, /)[source]

Return self*value.

__ne__(value, /)[source]

Return self!=value.

__neg__()[source]

-self

__new__(**kwargs)[source]
__pos__()[source]

+self

__pow__(value, mod=None, /)[source]

Return pow(self, value, mod).

__radd__(value, /)[source]

Return value+self.

__rdivmod__(value, /)[source]

Return divmod(value, self).

__repr__()[source]

Return repr(self).

__rfloordiv__(value, /)[source]

Return value//self.

__rmod__(value, /)[source]

Return value%self.

__rmul__(value, /)[source]

Return value*self.

__round__(ndigits=None, /)[source]

Return the Integral closest to x, rounding half toward even.

When an argument is passed, work like built-in round(x, ndigits).

__rpow__(value, mod=None, /)[source]

Return pow(value, self, mod).

__rsub__(value, /)[source]

Return value-self.

__rtruediv__(value, /)[source]

Return value/self.

__sub__(value, /)[source]

Return self-value.

__truediv__(value, /)[source]

Return self/value.

__trunc__()[source]

Return the Integral closest to x between 0 and x.

as_integer_ratio()[source]

Return a pair of integers, whose ratio is exactly equal to the original float.

The ratio is in lowest terms and has a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.

>>> (10.0).as_integer_ratio()
(10, 1)
>>> (0.0).as_integer_ratio()
(0, 1)
>>> (-.25).as_integer_ratio()
(-1, 4)
conjugate()[source]

Return self, the complex conjugate of any float.

fromhex()[source]

Create a floating-point number from a hexadecimal string.

>>> float.fromhex('0x1.ffffp10')
2047.984375
>>> float.fromhex('-0x1p-1074')
-5e-324
hex()[source]

Return a hexadecimal representation of a floating-point number.

>>> (-0.1).hex()
'-0x1.999999999999ap-4'
>>> 3.14159.hex()
'0x1.921f9f01b866ep+1'
imag[source]

the imaginary part of a complex number

is_integer()[source]

Return True if the float is an integer.

real[source]

the real part of a complex number