diff options
| author | morefigs <morefigs@gmail.com> | 2019-02-09 11:38:42 +1100 |
|---|---|---|
| committer | morefigs <morefigs@gmail.com> | 2019-02-09 11:38:42 +1100 |
| commit | b1fb6259bec08f4613a87e795586fc3c34b1db9a (patch) | |
| tree | 047815ee0fda241f08f4f944bae6c7297e8d787d | |
| parent | 609a42a67aa21463a1bcb1db6e4c4ce7faa31f99 (diff) | |
| download | pymba-b1fb6259bec08f4613a87e795586fc3c34b1db9a.tar.gz pymba-b1fb6259bec08f4613a87e795586fc3c34b1db9a.zip | |
added type hinting
| -rw-r--r-- | pymba/feature.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pymba/feature.py b/pymba/feature.py index 934a1c2..571f2b5 100644 --- a/pymba/feature.py +++ b/pymba/feature.py @@ -1,5 +1,5 @@ from ctypes import byref, sizeof, c_uint32, c_double, c_char_p, c_bool, c_int64, create_string_buffer -from typing import Tuple, List, Callable +from typing import Union, Tuple, List, Callable from .vimba_exception import VimbaException from . import vimba_c @@ -24,7 +24,7 @@ class Feature: """ @property - def name(self): + def name(self) -> str: return self._name.decode() @property @@ -32,16 +32,16 @@ class Feature: return self._feature_info() @property - def value(self): + def value(self) -> Union[str, int, float, bool]: return self._access_func('get', self.info.featureDataType)() @value.setter - def value(self, val): - self._access_func('set', self.info.featureDataType)(val) + def value(self, value: Union[str, int, float, bool]) -> None: + self._access_func('set', self.info.featureDataType)(value) @property - def range(self): - # only some types have a range + def range(self) -> Union[None, Tuple[int, int], Tuple[float, float], Tuple[str, str]]: + # only some types actually have a range if self.info.featureDataType in (_FEATURE_DATA_INT, _FEATURE_DATA_FLOAT, _FEATURE_DATA_ENUM): return self._access_func('range', self.info.featureDataType)() return None |
