Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/config.py @ 383:5c72da46b8ae
Implemented Configuration.getfirstfloatvar_s().
This was missing.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 10 Nov 2021 01:53:23 +0100 |
| parents | 24db29162d09 |
| children | 8c3aaa894089 |
comparison
equal
deleted
inserted
replaced
| 382:24db29162d09 | 383:5c72da46b8ae |
|---|---|
| 360 """Get a (possibly substituted) variable and convert text to a | 360 """Get a (possibly substituted) variable and convert text to a |
| 361 float | 361 float |
| 362 | 362 |
| 363 """ | 363 """ |
| 364 s = self.getvar_s(varname, default) | 364 s = self.getvar_s(varname, default) |
| 365 if isinstance(s, self._TEXTTYPE): | |
| 366 return float(s) | |
| 367 else: | |
| 368 return s | |
| 369 | |
| 370 def getfirstfloatvar_s(self, varname, default=_MARKER): | |
| 371 """Get a (possibly substituted) variable and convert text to a | |
| 372 float | |
| 373 | |
| 374 """ | |
| 375 s = self.getfirstvar_s(varname, default) | |
| 365 if isinstance(s, self._TEXTTYPE): | 376 if isinstance(s, self._TEXTTYPE): |
| 366 return float(s) | 377 return float(s) |
| 367 else: | 378 else: |
| 368 return s | 379 return s |
| 369 | 380 |
