Return a Group instance which can act as the root group in a tree. If file is opened in "r", "r+" or "a" mode, and the file already exists, this method dynamically builds a python object tree emulating the structure present on file.
(
self, root_uep: str | None, title: str, filters: Filters
)
| 863 | ne.set_vml_num_threads(params["MAX_NUMEXPR_THREADS"]) |
| 864 | |
| 865 | def __get_root_group( |
| 866 | self, root_uep: str | None, title: str, filters: Filters |
| 867 | ) -> RootGroup: |
| 868 | """Return a Group instance which can act as the root group in a tree. |
| 869 | |
| 870 | If file is opened in "r", "r+" or "a" mode, and the file already |
| 871 | exists, this method dynamically builds a python object tree |
| 872 | emulating the structure present on file. |
| 873 | |
| 874 | """ |
| 875 | self._v_objectid = self._get_file_id() |
| 876 | |
| 877 | if root_uep in [None, ""]: |
| 878 | root_uep = "/" |
| 879 | # Save the User Entry Point in a variable class |
| 880 | self.root_uep = root_uep |
| 881 | |
| 882 | new = self._v_new |
| 883 | |
| 884 | # Get format version *before* getting the object tree |
| 885 | if not new: |
| 886 | # Firstly, get the PyTables format version for this file |
| 887 | self.format_version = utilsextension.read_f_attr( |
| 888 | self._v_objectid, "PYTABLES_FORMAT_VERSION" |
| 889 | ) |
| 890 | if not self.format_version: |
| 891 | # PYTABLES_FORMAT_VERSION attribute is not present |
| 892 | self.format_version = "unknown" |
| 893 | self._isPTFile = False |
| 894 | elif not isinstance(self.format_version, str): |
| 895 | # system attributes should always be str |
| 896 | self.format_version = self.format_version.decode("utf-8") |
| 897 | |
| 898 | # Create new attributes for the root Group instance and |
| 899 | # create the object tree |
| 900 | return RootGroup(self, root_uep, title=title, new=new, filters=filters) |
| 901 | |
| 902 | def _get_or_create_path( |
| 903 | self, path: Node | str, create: bool |