diff --git a/src/python/jw/util/Options.py b/src/python/jw/util/Options.py index 400ae69..2bc75d7 100644 --- a/src/python/jw/util/Options.py +++ b/src/python/jw/util/Options.py @@ -153,20 +153,19 @@ class Options: # export def get(self, key: Any, default: Any = None, by_index: bool = False) -> Any: if by_index: - if isinstance(key, int): + if not isinstance(key, int): raise KeyError( 'Tried to get value from options string with ' + 'index {} of type "{}": {}'.format(key, type(key), str(self)) ) - if isinstance(key, int) and key >= len(self.__data.pairs): + if key >= len(self.__data.pairs): if default is not None: return default raise KeyError( 'Tried to get value from options string with ' + 'index {} of {}: {}'.format(key, len(self.__data.pairs), str(self)) ) - if isinstance(key, int): - return self.__list[key] + return self.__list[key] if key in self.__dict.keys(): return self.__dict[key] if default is not None: