(self, node, h5file, **kwargs)
| 575 | ] |
| 576 | |
| 577 | def __init__(self, node, h5file, **kwargs): |
| 578 | if node is not None: |
| 579 | # Open an existing node and get its version. |
| 580 | self._check_attributes(node) |
| 581 | self._version = node.attrs.NODE_TYPE_VERSION |
| 582 | elif h5file is not None: |
| 583 | # Check for allowed keyword arguments, |
| 584 | # to avoid unwanted arguments falling through to array constructor. |
| 585 | for kwarg in kwargs: |
| 586 | if kwarg not in self.__allowed_init_kwargs: |
| 587 | raise TypeError( |
| 588 | "%s keyword argument is not allowed" % repr(kwarg) |
| 589 | ) |
| 590 | |
| 591 | # Turn 'expectedsize' into 'expectedrows'. |
| 592 | if "expectedsize" in kwargs: |
| 593 | # These match since one byte is stored per row. |
| 594 | expectedrows = kwargs["expectedsize"] |
| 595 | kwargs = kwargs.copy() |
| 596 | del kwargs["expectedsize"] |
| 597 | kwargs["expectedrows"] = expectedrows |
| 598 | |
| 599 | # Create a new array in the specified PyTables file. |
| 600 | self._version = NodeTypeVersions[-1] |
| 601 | shape = self._byte_shape[self._version] |
| 602 | node = h5file.create_earray( |
| 603 | atom=tb.UInt8Atom(), shape=shape, **kwargs |
| 604 | ) |
| 605 | |
| 606 | # Set the node attributes, else remove the array itself. |
| 607 | try: |
| 608 | self._set_attributes(node) |
| 609 | except RuntimeError: |
| 610 | h5file.remove_node(kwargs["where"], kwargs["name"]) |
| 611 | raise |
| 612 | |
| 613 | RawPyTablesIO.__init__(self, node, "a+") |
| 614 | self._checkReadable() |
| 615 | self._checkWritable() |
| 616 | |
| 617 | @property |
| 618 | def node(self): |
nothing calls this directly
no test coverage detected