<commit_before>from __future__ import annotations

from typing import Union, Optional, Any, TYPE_CHECKING, cast, List

from collections import Iterable
import logging

import numpy as np

from progressivis.core.utils import integer_types
from progressivis.core.bitmap import bitmap
from .base import Dataset
from .hierarchy import AttributeImpl


if TYPE_CHECKING:
    from .base import Shape, DTypeLike, ArrayLike, Attribute

logger = logging.getLogger(__name__)


class RangeError(RuntimeError):
    pass


class RangeDataset(Dataset):
    def __init__(
        self,
        name: str,
        shape: Optional[Shape] = None,
        dtype: Optional[DTypeLike] = None,
        data: Optional[Any] = None,
        **kwds,
    ):
        self._name = name
        if shape is None:
            if data is not None and hasattr(data, "shape"):
                shape = data.shape
            else:
                shape = (0,)
        if len(shape) != 1:
            raise ValueError(
                "RangeDataset shape should be one-dimensional and not %s", shape
            )
        self._shape = shape
        if dtype is not None:
            if dtype != np.int_:
                raise TypeError("dtype of a RangeDataset should be integer")
        self._dtype: np.dtype = np.dtype(np.int_)
        if kwds:
            logger.warning("Unused arguments %s", kwds)
        self._attrs = AttributeImpl()

    @property
    def shape(self) -> Shape:
        return self._shape

    @property
    def dtype(self) -> np.dtype:
        return self._dtype

    @property
    def maxshape(self) -> Shape:
        return self._shape

    @property<commit_msg>Fix missing methods<commit_after>from __future__ import annotations

from typing import Union, Optional, Any, TYPE_CHECKING, cast, List

from collections import Iterable
import logging

import numpy as np

from progressivis.core.utils import integer_types
from progressivis.core.bitmap import bitmap
from .base import Dataset
from .hierarchy import AttributeImpl


if TYPE_CHECKING:
    from .base import Shape, DTypeLike, ArrayLike, Attribute

logger = logging.getLogger(__name__)


class RangeError(RuntimeError):
    pass


class RangeDataset(Dataset):
    def __init__(
        self,
        name: str,
        shape: Optional[Shape] = None,
        dtype: Optional[DTypeLike] = None,
        data: Optional[Any] = None,
        **kwds,
    ):
        self._name = name
        if shape is None:
            if data is not None and hasattr(data, "shape"):
                shape = data.shape
            else:
                shape = (0,)
        if len(shape) != 1:
            raise ValueError(
                "RangeDataset shape should be one-dimensional and not %s", shape
            )
        self._shape = shape
        if dtype is not None:
            if dtype != np.int_:
                raise TypeError("dtype of a RangeDataset should be integer")
        self._dtype: np.dtype = np.dtype(np.int_)
        if kwds:
            logger.warning("Unused arguments %s", kwds)
        self._attrs = AttributeImpl()

    def flush(self) -> None:
        pass

    def close_all(self, recurse=True) -> None:
        pass

    @property
    def shape(self) -> Shape:
        return self._shape

    @property
    def dtype(self) -> np.dtype:
        return self._dtype

    @property
    def maxshape(self) -> Shape:
        return self._shape

    @property
{'fraction_non_alphanumeric': 0.08250438853130486, 'fraction_numerical': 0.0011702750146284377, 'mean_word_length': 2.136697247706422, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2336185', 'n_tokens_mistral': 958, 'n_tokens_neox': 947, 'n_words': 312}