Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/config.py @ 202:2e66178a09d8
Docu: Ban "keyword expansion" -- use "variable interpolation" instead
"Variable interpolation" or "variable expansion" or "variable substitution"
are the proper wordings.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 05 May 2019 12:07:27 +0200 |
| parents | e2e8d21b4122 |
| children | b3b5ed34d180 |
comparison
equal
deleted
inserted
replaced
| 201:24f4ab79a3ab | 202:2e66178a09d8 |
|---|---|
| 56 | 56 |
| 57 def getvar(self, varname, default=_MARKER): | 57 def getvar(self, varname, default=_MARKER): |
| 58 """Get a variable of the form ``[ns:][[key1.]key2.]name`` - including | 58 """Get a variable of the form ``[ns:][[key1.]key2.]name`` - including |
| 59 variables from other namespaces. | 59 variables from other namespaces. |
| 60 | 60 |
| 61 No variable expansion is done and no filters are applied. | 61 No variable interpolation is done and no filters are applied. |
| 62 | 62 |
| 63 """ | 63 """ |
| 64 varns, varname = self._split_ns(varname) | 64 varns, varname = self._split_ns(varname) |
| 65 try: | 65 try: |
| 66 if not varns: | 66 if not varns: |
| 78 | 78 |
| 79 def getvar_s(self, varname, default=_MARKER): | 79 def getvar_s(self, varname, default=_MARKER): |
| 80 """Get a variable - including variables from other namespaces. | 80 """Get a variable - including variables from other namespaces. |
| 81 | 81 |
| 82 `varname` is interpreted as in :meth:`.getvar`. But variables | 82 `varname` is interpreted as in :meth:`.getvar`. But variables |
| 83 will be expanded recursively within the variable values and | 83 will be interpolated recursively within the variable values |
| 84 filters are applied. | 84 and filters are applied. |
| 85 | 85 |
| 86 For more details see chapter :ref:`variable-expansion`. | 86 For more details see chapter :ref:`variable-interpolation`. |
| 87 | 87 |
| 88 """ | 88 """ |
| 89 try: | 89 try: |
| 90 obj = self.getvar(varname) | 90 obj = self.getvar(varname) |
| 91 return self.substitute_variables_in_obj(obj) | 91 return self.substitute_variables_in_obj(obj) |
