trimesh.typed module¶
- class trimesh.typed.Any(*args, **kwargs)¶
Bases:
object
Special type indicating an unconstrained type.
Any is compatible with every type.
Any assumed to have all methods.
All values assumed to be instances of Any.
Note that all the above statements are true from the point of view of static type checkers. At runtime, Any should not be used with instance checks.
- class trimesh.typed.BinaryIO¶
Bases:
IO
[bytes
]Typed version of the return of open() in binary mode.
- abstract write(s: bytes | bytearray) int ¶
- class trimesh.typed.Callable¶
Bases:
object
- trimesh.typed.Dict¶
alias of
dict
- class trimesh.typed.Hashable¶
Bases:
object
- class trimesh.typed.IO¶
Bases:
Generic
Generic base class for TextIO and BinaryIO.
This is an abstract, generic version of the return of open().
NOTE: This does not distinguish between the different possible classes (text vs. binary, read vs. write vs. read/write, append-only, unbuffered). The TextIO and BinaryIO subclasses below capture the distinctions between text vs. binary, which is pervasive in the interface; however we currently do not offer a way to track the other distinctions in the type system.
- abstract close() None ¶
- abstract property closed: bool¶
- abstract fileno() int ¶
- abstract flush() None ¶
- abstract isatty() bool ¶
- abstract property mode: str¶
- abstract property name: str¶
- abstract read(n: int = -1) AnyStr ¶
- abstract readable() bool ¶
- abstract readline(limit: int = -1) AnyStr ¶
- abstract readlines(hint: int = -1) List ¶
- abstract seek(offset: int, whence: int = 0) int ¶
- abstract seekable() bool ¶
- abstract tell() int ¶
- abstract truncate(size: int = None) int ¶
- abstract writable() bool ¶
- abstract write(s: AnyStr) int ¶
- abstract writelines(lines: List) None ¶
- class trimesh.typed.Iterable¶
Bases:
object
- trimesh.typed.List¶
alias of
list
- class trimesh.typed.Mapping¶
Bases:
Collection
A Mapping is a generic container for associating key/value pairs.
This class provides concrete generic implementations of all methods except for __getitem__, __iter__, and __len__.
- get(k[, d]) D[k] if k in D, else d. d defaults to None. ¶
- items() a set-like object providing a view on D's items ¶
- keys() a set-like object providing a view on D's keys ¶
- values() an object providing a view on D's values ¶
- class trimesh.typed.Sequence¶
Bases:
Reversible
,Collection
All the operations on a read-only sequence.
Concrete subclasses must override __new__ or __init__, __getitem__, and __len__.
- count(value) integer -- return number of occurrences of value ¶
- index(value[, start[, stop]]) integer -- return first index of value. ¶
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- trimesh.typed.Tuple¶
alias of
tuple
- class trimesh.typed.float64(x=0, /)¶
Bases:
floating
,float
Double-precision floating-point number type, compatible with Python
float
and Cdouble
.- Character code:
'd'
- Canonical name:
numpy.double
- Alias on this platform (Linux x86_64):
numpy.float64: 64-bit precision floating-point number type: sign bit, 11 bits exponent, 52 bits mantissa.
- as_integer_ratio()¶
Return a pair of integers, whose ratio is exactly equal to the original floating point number, and with a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.
>>> np.double(10.0).as_integer_ratio() (10, 1) >>> np.double(0.0).as_integer_ratio() (0, 1) >>> np.double(-.25).as_integer_ratio() (-1, 4)
- is_integer() bool ¶
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
Examples
>>> np.double(-2.0).is_integer() True >>> np.double(3.2).is_integer() False
- class trimesh.typed.int64¶
Bases:
signedinteger
Default signed integer type, 64bit on 64bit systems and 32bit on 32bit systems.
- Character code:
'l'
- Canonical name:
numpy.int_
- Alias on this platform (Linux x86_64):
numpy.int64: 64-bit signed integer (
-9_223_372_036_854_775_808
to9_223_372_036_854_775_807
).- Alias on this platform (Linux x86_64):
numpy.intp: Signed integer large enough to fit pointer, compatible with C
intptr_t
.
- bit_count() int ¶
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcount
in C++.Examples
>>> np.int64(127).bit_count() 7 >>> np.int64(-127).bit_count() 7