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

Method _g_copy

tables/leaf.py:574–629  ·  view source on GitHub ↗
(
        self,
        newparent: Group,
        newname: str,
        recursive: bool,
        _log: bool = True,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

572 return (start, stop, step)
573
574 def _g_copy(
575 self,
576 newparent: Group,
577 newname: str,
578 recursive: bool,
579 _log: bool = True,
580 **kwargs,
581 ) -> Leaf:
582 # Compute default arguments.
583 start = kwargs.pop("start", None)
584 stop = kwargs.pop("stop", None)
585 step = kwargs.pop("step", None)
586 title = kwargs.pop("title", self._v_title)
587 filters = kwargs.pop("filters", self.filters)
588 chunkshape = kwargs.pop("chunkshape", self.chunkshape)
589 copyuserattrs = kwargs.pop("copyuserattrs", True)
590 stats = kwargs.pop("stats", None)
591 if chunkshape == "keep":
592 chunkshape = self.chunkshape # Keep the original chunkshape
593 elif chunkshape == "auto":
594 chunkshape = None # Will recompute chunkshape
595
596 # Fix arguments with explicit None values for backwards compatibility.
597 if title is None:
598 title = self._v_title
599 if filters is None:
600 filters = self.filters
601
602 # Create a copy of the object.
603 new_node, bytes_ = self._g_copy_with_stats(
604 newparent,
605 newname,
606 start,
607 stop,
608 step,
609 title,
610 filters,
611 chunkshape,
612 _log,
613 **kwargs,
614 )
615
616 # Copy user attributes if requested (or the flavor at least).
617 if copyuserattrs:
618 self._v_attrs._g_copy(new_node._v_attrs, copyclass=True)
619 elif "FLAVOR" in self._v_attrs:
620 if self._v_file.params["PYTABLES_SYS_ATTRS"]:
621 new_node._v_attrs._g__setattr("FLAVOR", self._flavor)
622 new_node._flavor = self._flavor # update cached value
623
624 # Update statistics if needed.
625 if stats is not None:
626 stats["leaves"] += 1
627 stats["bytes"] += bytes_
628
629 return new_node
630
631 def _g_fix_byteorder_data(

Callers

nothing calls this directly

Calls 3

popMethod · 0.80
_g__setattrMethod · 0.80
_g_copy_with_statsMethod · 0.45

Tested by

no test coverage detected