Skip to content

Commit

Permalink
add sectionwrapper get overload types
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Jan 4, 2023
1 parent 90df3d7 commit c7d1d88
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/iniconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,42 @@ def __init__(self, config: IniConfig, name: str) -> None:
def lineof(self, name: str) -> int | None:
return self.config.lineof(self.name, name)

@overload
def get(self, key: str) -> str | None:
...

@overload
def get(
self,
key: str,
convert: Callable[[str], _T],
) -> _T | None:
...

@overload
def get(
self,
key: str,
default: None,
convert: Callable[[str], _T],
) -> _T | None:
...

@overload
def get(self, key: str, default: _D, convert: None = None) -> str | _D:
...

@overload
def get(
self,
key: str,
default: _D,
convert: Callable[[str], _T],
) -> _T | _D:
...

# TODO: investigate possible mypy bug wrt matching the passed over data
def get( # type: ignore [misc]
self,
key: str,
default: _D | None = None,
Expand Down

0 comments on commit c7d1d88

Please sign in to comment.