comparison configmix/config.py @ 302:063099b188cd

Docu
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 25 Apr 2021 14:05:16 +0200
parents eed16a1ec8f3
children d8361dd70d2d
comparison
equal deleted inserted replaced
301:a03a6797533b 302:063099b188cd
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # :- 2 # :-
3 # :Copyright: (c) 2015-2020, Franz Glasner. All rights reserved. 3 # :Copyright: (c) 2015-2021, Franz Glasner. All rights reserved.
4 # :License: BSD-3-Clause. See LICENSE.txt for details. 4 # :License: BSD-3-Clause. See LICENSE.txt for details.
5 # :- 5 # :-
6 """The unified configuration dictionary with attribute support or 6 """The unified configuration dictionary with attribute support or
7 variable substitution. 7 variable substitution.
8 8
200 # Speed 200 # Speed
201 _STARTTOK = u(b"{{") 201 _STARTTOK = u(b"{{")
202 _ENDTOK = u(b"}}") 202 _ENDTOK = u(b"}}")
203 203
204 def expand_variable(self, s): 204 def expand_variable(self, s):
205 """Expand variables in a single string""" 205 """Expand variables in the single string `s`"""
206 start = s.find(self._STARTTOK, 0) 206 start = s.find(self._STARTTOK, 0)
207 while start != -1: 207 while start != -1:
208 end = s.find(self._ENDTOK, start) 208 end = s.find(self._ENDTOK, start)
209 if end < 0: 209 if end < 0:
210 return s 210 return s