kittycad.models.length_unit.LengthUnit
- class kittycad.models.length_unit.LengthUnit(x=0, /)[source][source]
Bases:
float
Methods
__init__
()Return a pair of integers, whose ratio is exactly equal to the original float.
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.
Return True if the float is an integer.
Attributes
the imaginary part of a complex number
the real part of a complex number
- __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]
- classmethod __get_pydantic_core_schema__(source_type, handler)[source][source]
- Return type:
Union
[InvalidSchema
,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.
- __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).
- 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)
- fromhex()[source]
Create a floating-point number from a hexadecimal string.
>>> float.fromhex('0x1.ffffp10') 2047.984375 >>> float.fromhex('-0x1p-1074') -5e-324