Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/config.py @ 489:b49164db1273
Remove unused keyword params for ._lookupvar().
It it never called with "default".
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Fri, 17 Dec 2021 16:28:09 +0100 |
| parents | 298510ec8171 |
| children | ea4b7fac02d6 |
comparison
equal
deleted
inserted
replaced
| 488:298510ec8171 | 489:b49164db1273 |
|---|---|
| 569 else: | 569 else: |
| 570 return (name.rstrip(), []) | 570 return (name.rstrip(), []) |
| 571 else: | 571 else: |
| 572 return (name, []) | 572 return (name, []) |
| 573 | 573 |
| 574 def _lookupvar(self, *path, **kwds): | 574 def _lookupvar(self, *path): |
| 575 """Lookup a variable within a hierarchy. | 575 """Lookup a variable within a hierarchy. |
| 576 | 576 |
| 577 If no default is given an unexisting `path` raises a `KeyError` | 577 :raise KeyError: An unexisting `path` raises a `KeyError` |
| 578 else `default` is returned. | 578 |
| 579 """ | 579 """ |
| 580 default = kwds.pop("default", _MARKER) | |
| 581 if not path: | 580 if not path: |
| 582 return self | 581 return self |
| 583 try: | 582 try: |
| 584 v = self.expand_if_reference( | 583 v = self.expand_if_reference( |
| 585 super(Configuration, self).__getitem__(path[0])) | 584 super(Configuration, self).__getitem__(path[0])) |
| 587 v = self.expand_if_reference(v[p]) | 586 v = self.expand_if_reference(v[p]) |
| 588 except TypeError: | 587 except TypeError: |
| 589 raise KeyError( | 588 raise KeyError( |
| 590 "Configuration variable %r not found" | 589 "Configuration variable %r not found" |
| 591 "(missing intermediate keys?)" % (path,)) | 590 "(missing intermediate keys?)" % (path,)) |
| 592 except KeyError: | |
| 593 if default is _MARKER: | |
| 594 raise KeyError( | |
| 595 "Configuration variable %r not found" % (path,)) | |
| 596 else: | |
| 597 return default | |
| 598 return v | 591 return v |
| 599 | 592 |
| 600 def _lookupref(self, key, default=_MARKER): | 593 def _lookupref(self, key, default=_MARKER): |
| 601 """ | 594 """ |
| 602 | 595 |
