diff options
| author | Josh Ferrell <josh@vector35.com> | 2024-04-21 22:05:45 -0400 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2024-04-21 22:08:46 -0400 |
| commit | 72cb4b08ac8f7c9261867cd6c0b18c054d73b96e (patch) | |
| tree | 8071e25bb466cb78ee2fab70d1224aab494a250f /python/binaryview.py | |
| parent | 32560285ef48669582b90e046d1920a957630ae0 (diff) | |
Improve type hints for many __getitem__ impls
Diffstat (limited to 'python/binaryview.py')
| -rw-r--r-- | python/binaryview.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 4a160983..d740ce92 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -30,7 +30,7 @@ import inspect import os import uuid from typing import Callable, Generator, Optional, Union, Tuple, List, Mapping, Any, \ - Iterator, Iterable, KeysView, ItemsView, ValuesView, Dict + Iterator, Iterable, KeysView, ItemsView, ValuesView, Dict, overload from dataclasses import dataclass from enum import IntFlag @@ -1985,6 +1985,12 @@ class FunctionList: self._n += 1 return _function.Function(self._view, func) + @overload + def __getitem__(self, i: int) -> '_function.Function': ... + + @overload + def __getitem__(self, i: slice) -> List['_function.Function']: ... + def __getitem__(self, i: Union[int, slice]) -> Union['_function.Function', List['_function.Function']]: if isinstance(i, int): if i < 0: |
