Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Impala._parseErrorMsg.format(path=new_path)
+ (error + "\n" + content)
)
if df.shape[0] > 0:
return df.drop_duplicates()
error_msg: Optional[str] = None
with cachename.open("r") as fh:
output = fh.readlines()
if any(elt.startswith("ERROR:") for elt in output):
error_msg = "".join(output[:-1])
if error_msg is not None:
cachename.unlink()
raise ImpalaError(error_msg)
return None
return "".join(fh.readlines())
if count > 0:
s.seek(0)
try:
# otherwise pandas would parse 1234e5 as 123400000.0
df = pd.read_csv(s, dtype={"icao24": str, "callsign": str})
except ParserError as error:
for x in re.finditer(r"line (\d)+,", error.args[0]):
line_nb = int(x.group(1))
with cachename.open("r") as fh:
content = fh.readlines()[line_nb - 1]
new_path = Path(gettempdir()) / cachename.name
cachename.rename(new_path)
raise ImpalaError(
Impala._parseErrorMsg.format(path=new_path)
+ (error + "\n" + content)
)
if df.shape[0] > 0:
return df.drop_duplicates()
error_msg: Optional[str] = None
with cachename.open("r") as fh:
output = fh.readlines()
if any(elt.startswith("ERROR:") for elt in output):
error_msg = "".join(output[:-1])
if error_msg is not None:
cachename.unlink()
raise ImpalaError(error_msg)