akrherz / pyIEM

if statements can be merged PTC-W0048
Anti-pattern
Major
10 months ago3 years old
Consider merging collapsible if statements
 44            (vtec.office, vtec.etn, vtec.significance, vtec.phenomena),
 45        )
 46        row = txn.fetchone()
 47        if row["max"] is not None: 48            if (prod.valid - row["max"]).total_seconds() > (21 * 86400):
 49                prod.warnings.append(
 50                    "Possible Duplicated ETN\n"
Consider merging collapsible if statements
590            prod.valid,
591        ),
592    )
593    if txn.rowcount != len(segment.ugcs):594        if not prod.is_correction():
595            prod.warnings.append(_debug_warning(prod, txn, vtec, segment, ets))
596
Consider merging collapsible if statements
 77                    "Segment has duplicated VTEC for a "
 78                    "single phenomena / significance"
 79                )
 80            if segment.giswkt and not segment.vtec: 81                if self.afos is not None and self.afos[:3] not in ["MWS"]:
 82                    self.warnings.append(
 83                        "Product segment has LAT...LON, "
Consider merging collapsible if statements
 85    # Get the weather phenomena
 86    phenomena = []
 87    elem = airmet.find("clouds", NS)
 88    if elem is not None: 89        if elem.text == "true":
 90            phenomena.append("clouds")
 91    for elem in airmet.findall(".//weatherPhenomenon", NS):
Consider merging collapsible if statements
121                    newtext = newtext.replace(f" {token}", "")
122                if newtext != text:
123                    text = newtext
124            if str(inst).find("day is out of range for month") > -1:125                if valid.day < 10:
126                    valid = valid.replace(day=1) - timedelta(days=1)
127        attempt += 1