Define the iteration interface on a table Parameters ---------- store : HDFStore s : the referred storer func : the function to execute the query where : the where of the query nrows : the rows to iterate on start : the passed start value (default is None)
| 2019 | |
| 2020 | |
| 2021 | class TableIterator: |
| 2022 | """ |
| 2023 | Define the iteration interface on a table |
| 2024 | |
| 2025 | Parameters |
| 2026 | ---------- |
| 2027 | store : HDFStore |
| 2028 | s : the referred storer |
| 2029 | func : the function to execute the query |
| 2030 | where : the where of the query |
| 2031 | nrows : the rows to iterate on |
| 2032 | start : the passed start value (default is None) |
| 2033 | stop : the passed stop value (default is None) |
| 2034 | iterator : bool, default False |
| 2035 | Whether to use the default iterator. |
| 2036 | chunksize : the passed chunking value (default is 100000) |
| 2037 | auto_close : bool, default False |
| 2038 | Whether to automatically close the store at the end of iteration. |
| 2039 | """ |
| 2040 | |
| 2041 | chunksize: int | None |
| 2042 | store: HDFStore |
| 2043 | s: GenericFixed | Table |
| 2044 | |
| 2045 | def __init__( |
| 2046 | self, |
| 2047 | store: HDFStore, |
| 2048 | s: GenericFixed | Table, |
| 2049 | func, |
| 2050 | where, |
| 2051 | nrows, |
| 2052 | start=None, |
| 2053 | stop=None, |
| 2054 | iterator: bool = False, |
| 2055 | chunksize: int | None = None, |
| 2056 | auto_close: bool = False, |
| 2057 | ) -> None: |
| 2058 | self.store = store |
| 2059 | self.s = s |
| 2060 | self.func = func |
| 2061 | self.where = where |
| 2062 | |
| 2063 | # set start/stop if they are not set if we are a table |
| 2064 | if self.s.is_table: |
| 2065 | if nrows is None: |
| 2066 | nrows = 0 |
| 2067 | if start is None: |
| 2068 | start = 0 |
| 2069 | if stop is None: |
| 2070 | stop = nrows |
| 2071 | stop = min(nrows, stop) |
| 2072 | |
| 2073 | self.nrows = nrows |
| 2074 | self.start = start |
| 2075 | self.stop = stop |
| 2076 | |
| 2077 | self.coordinates = None |
| 2078 | if iterator or chunksize is not None: |
no outgoing calls
no test coverage detected