MCPcopy Create free account
hub / github.com/PyTables/PyTables / __init__

Method __init__

tables/atom.py:511–536  ·  view source on GitHub ↗
(
        self, nptype: str | np.dtype, shape: Shape, dflt: Any
    )

Source from the content-addressed store, hash-verified

509 return len(self.shape)
510
511 def __init__(
512 self, nptype: str | np.dtype, shape: Shape, dflt: Any
513 ) -> None:
514 if not hasattr(self, "type"):
515 raise NotImplementedError(
516 f"``{self.__class__.__name__}`` is an abstract class; "
517 f"please use one of its subclasses"
518 )
519 self.shape = shape = _normalize_shape(shape)
520 """The shape of the atom (a tuple for scalar atoms)."""
521 # Curiously enough, NumPy isn't generally able to accept NumPy
522 # integers in a shape. ;(
523 npshape = tuple(int(s) for s in shape)
524 self.dtype = dtype = np.dtype((nptype, npshape))
525 """The NumPy dtype that most closely matches this atom."""
526 self.dflt = _normalize_default(dflt, dtype)
527 """The default value of the atom.
528
529 If the user does not supply a value for an element while
530 filling a dataset, this default value will be written to
531 disk. If the user supplies a scalar value for a
532 multidimensional atom, this value is automatically *broadcast*
533 to all the items in the atom cell. If dflt is not supplied, an
534 appropriate zero value (or *null* string) will be chosen by
535 default. Please note that default values are kept internally
536 as NumPy objects."""
537
538 def __repr__(self) -> str:
539 args = f"shape={self.shape}, dflt={self.dflt!r}"

Callers 15

__init__Method · 0.45
__init__Function · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 3

_normalize_shapeFunction · 0.85
_normalize_defaultFunction · 0.85
dtypeMethod · 0.45

Tested by

no test coverage detected