Mercurial > p > roundup > code
diff roundup/roundupdb.py @ 6962:ff879aa00987
remove some unreachable code. If condition is always the same.
There is a test:
if not value: continue
then there is code below that at the same level that tests for:
if value:
and
if value is None:
Neither of these tests can be anything but the static values of True
and False respectively. Simplify code by removing the tests.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 12 Sep 2022 23:33:21 -0400 |
| parents | de3118b4d224 |
| children | 506c86823abb |
line wrap: on
line diff
--- a/roundup/roundupdb.py Mon Sep 12 23:25:10 2022 -0400 +++ b/roundup/roundupdb.py Mon Sep 12 23:33:21 2022 -0400 @@ -790,14 +790,10 @@ continue if isinstance(prop, hyperdb.Link): link = self.db.classes[prop.classname] - if value: - key = link.labelprop(default_to_id=1) - if key: - value = link.get(value, key) - else: - value = '' + key = link.labelprop(default_to_id=1) + if key: + value = link.get(value, key) elif isinstance(prop, hyperdb.Multilink): - if value is None: value = [] # noqa: E701 link = self.db.classes[prop.classname] key = link.labelprop(default_to_id=1) if key:
