Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/config.py @ 396:a50f8fb16b05
Style
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 18 Nov 2021 22:14:34 +0100 |
| parents | 0b3ffc34fa5c |
| children | 88239f28415c |
comparison
equal
deleted
inserted
replaced
| 395:0b3ffc34fa5c | 396:a50f8fb16b05 |
|---|---|
| 162 See also :meth:`~.quote`. | 162 See also :meth:`~.quote`. |
| 163 | 163 |
| 164 """ | 164 """ |
| 165 varns, varname = self._split_ns(varname) | 165 varns, varname = self._split_ns(varname) |
| 166 if not varns: | 166 if not varns: |
| 167 varnameparts = [self.unquote(vp) for vp in varname.split(self._HIER_SEPARATOR)] | 167 varnameparts = [ |
| 168 self.unquote(vp) for vp in varname.split(self._HIER_SEPARATOR) | |
| 169 ] | |
| 168 else: | 170 else: |
| 169 varnameparts = (varname,) | 171 varnameparts = (varname,) |
| 170 return self.getvarl(*varnameparts, namespace=varns, default=default) | 172 return self.getvarl(*varnameparts, namespace=varns, default=default) |
| 171 | 173 |
| 172 def getfirstvar(self, *varnames, **kwds): | 174 def getfirstvar(self, *varnames, **kwds): |
| 665 "jailed configurations do not support namespaces") | 667 "jailed configurations do not support namespaces") |
| 666 rootpath = [ | 668 rootpath = [ |
| 667 self.unquote(p) for p in root.split( | 669 self.unquote(p) for p in root.split( |
| 668 self._HIER_SEPARATOR) | 670 self._HIER_SEPARATOR) |
| 669 ] | 671 ] |
| 670 | 672 |
| 671 return _JailedConfiguration(self, *rootpath) | 673 return _JailedConfiguration(self, *rootpath) |
| 672 | 674 |
| 673 | 675 |
| 674 class _JailedConfiguration(object): | 676 class _JailedConfiguration(object): |
| 675 | 677 |
| 676 """Chrooted into a subtree of the configuration -- no namespace support""" | 678 """Chrooted into a subtree of the configuration -- no namespace support""" |
| 677 | 679 |
| 678 __slots__ = ("_base", "_path", "_pathstr" ) | 680 __slots__ = ("_base", "_path", "_pathstr") |
| 679 | 681 |
| 680 def __init__(self, config, *path): | 682 def __init__(self, config, *path): |
| 681 super(_JailedConfiguration, self).__init__() | 683 super(_JailedConfiguration, self).__init__() |
| 682 self._base = config | 684 self._base = config |
| 683 self._path = path | 685 self._path = path |
