Skip to content

Commit

Permalink
fix: remove incorrect type annotation in InputFileType
Browse files Browse the repository at this point in the history
  • Loading branch information
jayanthkoushik committed Sep 21, 2021
1 parent 003a5bf commit bb70a26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions corgy/types.py
Expand Up @@ -2,7 +2,7 @@
import os
from argparse import ArgumentTypeError, FileType
from pathlib import Path
from typing import Generic, IO, Iterator, Literal, Type, TypeVar
from typing import Generic, IO, Iterator, Type, TypeVar

__all__ = [
"OutputFileType",
Expand Down Expand Up @@ -54,7 +54,7 @@ class InputFileType(FileType):

__metavar__ = "file"

def __init__(self, mode: Literal["r", "rb"] = "r", **kwargs) -> None:
def __init__(self, mode: str = "r", **kwargs) -> None:
if any(c in mode for c in "wxa+"):
raise ValueError(f"invalid mode for `{type(self)}`: `{mode}`")
super().__init__(mode, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Expand Up @@ -331,7 +331,7 @@ Non-existing files are created (including parent directories).



### _class_ corgy.types.InputFileType(mode: Literal['r', 'rb'] = 'r', \*\*kwargs)
### _class_ corgy.types.InputFileType(mode: str = 'r', \*\*kwargs)
`argparse.FileType` subclass restricted to read mode.

This class exists primarily to provide a counterpart to `OutputFileType`.
Expand Down

0 comments on commit bb70a26

Please sign in to comment.