simplify tiramisu/option/symlinkoption.py

This commit is contained in:
Emmanuel Garette 2018-11-14 18:08:20 +01:00
parent dde7ad3373
commit 5d26762761
2 changed files with 8 additions and 12 deletions

View file

@ -29,7 +29,7 @@ class DynSymLinkOption(object):
def __init__(self, def __init__(self,
opt, opt,
rootpath, rootpath,
suffix): suffix) -> None:
self._opt = opt self._opt = opt
self._rootpath = rootpath self._rootpath = rootpath
self._suffix = suffix self._suffix = suffix

View file

@ -18,6 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/ # the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence # the whole pypy projet is under MIT licence
# ____________________________________________________________ # ____________________________________________________________
from typing import Any
from .baseoption import BaseOption from .baseoption import BaseOption
from ..i18n import _ from ..i18n import _
@ -39,26 +40,21 @@ class SymLinkOption(BaseOption):
opt._add_dependency(self) opt._add_dependency(self)
def __getattr__(self, def __getattr__(self,
name): name: str) -> Any:
if name == '_path':
return
return getattr(self._opt, name) return getattr(self._opt, name)
def impl_has_dependency(self, 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 True, it has dependency (self._opt), so return True
if self_is_dep is False, cannot has validation or callback, so return False 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 return True
def impl_getopt(self): def impl_getopt(self) -> BaseOption:
return self._opt return self._opt
def impl_is_readonly(self): def get_consistencies(self) -> tuple:
return self._path is not None
def get_consistencies(self):
return () return ()