WeblateOrg / weblate

Unguarded next inside generator PTC-W0063
Bug risk
Critical
2 occurrences in this check
Call to next() should be wrapped in try-except
149        except (SyntaxError, AssertionError):
150            report_error(cause="Could not parse")
151            raise MemoryImportError(gettext("Could not parse TMX file!"))
152        header = next(153            storage.document.getroot().iterchildren(storage.namespaced("header"))
154        )
155        lang_cache = {}
Call to next() should be wrapped in try-except
1564
1565        # Try reading header
1566        reader = csv.reader(fileobj, store.dialect)
1567        header = next(reader)1568        fileobj.close()
1569
1570        # Check if the file is not two column only