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

Method _g_post_init_hook

tables/table.py:886–958  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

884 )
885
886 def _g_post_init_hook(self) -> None:
887 # We are putting here the index-related issues
888 # as well as filling general info for table
889 # This is needed because we need first the index objects created
890
891 # First, get back the flavor of input data (if any) for
892 # `Leaf._g_post_init_hook()`.
893 self._flavor, self._descflavor = self._descflavor, None
894 super()._g_post_init_hook()
895
896 # Create a cols accessor.
897 self.cols = Cols(self, self.description)
898
899 # Place the `Cols` and `Column` objects into `self.colinstances`.
900 colinstances, cols = self.colinstances, self.cols
901 for colpathname in self.description._v_pathnames:
902 colinstances[colpathname] = cols._g_col(colpathname)
903
904 if self._v_new:
905 # Columns are never indexed on creation.
906 self.colindexed = dict.fromkeys(self.colpathnames, False)
907 return
908
909 # The following code is only for opened tables.
910
911 # Do the indexes group exist?
912 indexesgrouppath = _index_pathname_of(self)
913 igroup = indexesgrouppath in self._v_file
914 oldindexes = False
915 for colobj in self.description._f_walk(type="Col"):
916 colname = colobj._v_pathname
917 # Is this column indexed?
918 if igroup:
919 indexname = _index_pathname_of_column(self, colname)
920 indexed = indexname in self._v_file
921 self.colindexed[colname] = indexed
922 if indexed:
923 column = self.cols._g_col(colname)
924 indexobj = column.index
925 if isinstance(indexobj, OldIndex):
926 indexed = False # Not a vaild index
927 oldindexes = True
928 self._listoldindexes.append(colname)
929 else:
930 # Tell the condition cache about columns with dirty
931 # indexes.
932 if indexobj.dirty:
933 self._condition_cache.nail()
934 else:
935 indexed = False
936 self.colindexed[colname] = False
937 if indexed:
938 self.indexed = True
939
940 if oldindexes: # this should only appear under 2.x Pro
941 warnings.warn(
942 "table ``%s`` has column indexes with PyTables 1.x format. "
943 "Unfortunately, this format is not supported in "

Callers

nothing calls this directly

Calls 7

ColsClass · 0.85
_index_pathname_ofFunction · 0.85
_g_colMethod · 0.80
_f_walkMethod · 0.80
nailMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected