From 5d26762761b40297090e1e7e5d73cbac2fdda15a Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 14 Nov 2018 18:08:20 +0100 Subject: [PATCH] simplify tiramisu/option/symlinkoption.py --- tiramisu/option/dynsymlinkoption.py | 2 +- tiramisu/option/symlinkoption.py | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tiramisu/option/dynsymlinkoption.py b/tiramisu/option/dynsymlinkoption.py index 9dbc957..d2ae0c7 100644 --- a/tiramisu/option/dynsymlinkoption.py +++ b/tiramisu/option/dynsymlinkoption.py @@ -29,7 +29,7 @@ class DynSymLinkOption(object): def __init__(self, opt, rootpath, - suffix): + suffix) -> None: self._opt = opt self._rootpath = rootpath self._suffix = suffix diff --git a/tiramisu/option/symlinkoption.py b/tiramisu/option/symlinkoption.py index 869b64d..8476afa 100644 --- a/tiramisu/option/symlinkoption.py +++ b/tiramisu/option/symlinkoption.py @@ -18,6 +18,7 @@ # the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/ # the whole pypy projet is under MIT licence # ____________________________________________________________ +from typing import Any from .baseoption import BaseOption from ..i18n import _ @@ -39,26 +40,21 @@ class SymLinkOption(BaseOption): opt._add_dependency(self) def __getattr__(self, - name): - if name == '_path': - return + name: str) -> Any: return getattr(self._opt, name) def impl_has_dependency(self, - self_is_dep=True): + self_is_dep: bool=True) -> bool: """If self_is_dep is True, it has dependency (self._opt), so return True if self_is_dep is False, cannot has validation or callback, so return False """ - return self_is_dep is True + return self_is_dep - def impl_is_symlinkoption(self): + def impl_is_symlinkoption(self) -> bool: return True - def impl_getopt(self): + def impl_getopt(self) -> BaseOption: return self._opt - def impl_is_readonly(self): - return self._path is not None - - def get_consistencies(self): + def get_consistencies(self) -> tuple: return ()