Create some temporary objects for slice sorting purposes.
(self)
| 1112 | return False |
| 1113 | |
| 1114 | def create_temp(self) -> None: |
| 1115 | """Create some temporary objects for slice sorting purposes.""" |
| 1116 | # The index will be dirty during the index optimization process |
| 1117 | self.dirty = True |
| 1118 | # Build the name of the temporary file |
| 1119 | fd, self.tmpfilename = tempfile.mkstemp( |
| 1120 | ".tmp", "pytables-", self.tmp_dir |
| 1121 | ) |
| 1122 | # Close the file descriptor so as to avoid leaks |
| 1123 | os.close(fd) |
| 1124 | # Create the proper PyTables file |
| 1125 | self.tmpfile = self._openFile(self.tmpfilename, "w") |
| 1126 | self.tmp = tmp = self.tmpfile.root |
| 1127 | cs = self.chunksize |
| 1128 | ss = self.slicesize |
| 1129 | filters = self.filters |
| 1130 | # temporary sorted & indices arrays |
| 1131 | shape = (0, ss) |
| 1132 | atom = Atom.from_dtype(self.dtype) |
| 1133 | EArray( |
| 1134 | tmp, |
| 1135 | "sorted", |
| 1136 | atom, |
| 1137 | shape, |
| 1138 | "Temporary sorted", |
| 1139 | filters, |
| 1140 | chunkshape=(1, cs), |
| 1141 | ) |
| 1142 | EArray( |
| 1143 | tmp, |
| 1144 | "indices", |
| 1145 | UIntAtom(itemsize=self.indsize), |
| 1146 | shape, |
| 1147 | "Temporary indices", |
| 1148 | filters, |
| 1149 | chunkshape=(1, cs), |
| 1150 | ) |
| 1151 | # temporary bounds |
| 1152 | nbounds_inslice = (ss - 1) // cs |
| 1153 | shape = (0, nbounds_inslice) |
| 1154 | EArray( |
| 1155 | tmp, |
| 1156 | "bounds", |
| 1157 | atom, |
| 1158 | shape, |
| 1159 | "Temp chunk bounds", |
| 1160 | filters, |
| 1161 | chunkshape=(cs, nbounds_inslice), |
| 1162 | ) |
| 1163 | shape = (0,) |
| 1164 | EArray( |
| 1165 | tmp, |
| 1166 | "abounds", |
| 1167 | atom, |
| 1168 | shape, |
| 1169 | "Temp start bounds", |
| 1170 | filters, |
| 1171 | chunkshape=(cs,), |
no test coverage detected