<commit_before>import cgi
from enum import Enum
from io import BytesIO
from typing import Callable, Any, Tuple, Dict, List, Union, IO, Sequence

from rouver.exceptions import ArgumentsError
from rouver.types import WSGIEnvironment


class Multiplicity(Enum):

    ANY = "0+"
    REQUIRED_ANY = "1+"
    REQUIRED = "1"
    OPTIONAL = "0-1"


ArgumentValueParser = Callable[[str], Any]
ArgumentValueType = Union[ArgumentValueParser, str]
ArgumentTemplate = Tuple[str, ArgumentValueType, Multiplicity]
ArgumentDict = Dict[str, Any]


class _ArgumentError(Exception):

    pass


class FileArgument:

    """File argument result.

    This is a file-like object, containing a bytes. It has additional
    fields "filename" and "content_type", as supplied by the client.

    >>> args = parse_args(..., [
    ...     ("file-arg", "file", Multiplicity.REQUIRED),
    ... ])
    >>> args["file-arg"].filename
    'my-file.txt'
    >>> args["file-arg"].content_type
    'text/plain'
    >>> args["file-arg"].read()
    b'file content'
    """

    def __init__(self, stream: IO[bytes], filename: str, content_type: str) \
            -> None:
        self._stream = stream
        self.filename = filename
        self.content_type = content_type

    def __getattr__(self, name: str) -> Any:
        return getattr(self._stream, name)

<commit_msg>[typo] fix typos in FileArgument doc string<commit_after>import cgi
from enum import Enum
from io import BytesIO
from typing import Callable, Any, Tuple, Dict, List, Union, IO, Sequence

from rouver.exceptions import ArgumentsError
from rouver.types import WSGIEnvironment


class Multiplicity(Enum):

    ANY = "0+"
    REQUIRED_ANY = "1+"
    REQUIRED = "1"
    OPTIONAL = "0-1"


ArgumentValueParser = Callable[[str], Any]
ArgumentValueType = Union[ArgumentValueParser, str]
ArgumentTemplate = Tuple[str, ArgumentValueType, Multiplicity]
ArgumentDict = Dict[str, Any]


class _ArgumentError(Exception):

    pass


class FileArgument:

    """File argument result.

    This is a file-like object, containing a byte stream. It has additional
    fields "filename" and "content_type".

    >>> args = parse_args(..., [
    ...     ("file-arg", "file", Multiplicity.REQUIRED),
    ... ])
    >>> args["file-arg"].filename
    'my-file.txt'
    >>> args["file-arg"].content_type
    'text/plain'
    >>> args["file-arg"].read()
    b'file content'
    """

    def __init__(self, stream: IO[bytes], filename: str, content_type: str) \
            -> None:
        self._stream = stream
        self.filename = filename
        self.content_type = content_type

    def __getattr__(self, name: str) -> Any:
        return getattr(self._stream, name)


{'fraction_non_alphanumeric': 0.12448903753251579, 'fraction_numerical': 0.0037160906726124115, 'mean_word_length': 3.21283255086072, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, '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': '7340953', 'n_tokens_mistral': 845, 'n_tokens_neox': 814, 'n_words': 232}