Skip to content

Commit

Permalink
Flake8 maintenance: Lasio: part 1 (#566)
Browse files Browse the repository at this point in the history
- examples.py
- excel.py
  • Loading branch information
dcslagel authored Mar 3, 2023
1 parent aee63ef commit 52c02ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lasio/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def open_github_example(

response = urllib.request.urlopen(url)
if response.headers.get_content_charset() is None:
if "encoding" in encoding_kwargs:
encoding = encoding_kwargs["encoding"]
if "encoding" in kwargs:
encoding = kwargs["encoding"]
else:
encoding = "utf-8"
else:
Expand Down
12 changes: 7 additions & 5 deletions lasio/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def main():
lasfn = args.LAS_filename
xlsxfn = args.XLSX_filename

l = las.LASFile(lasfn)
converter = ExcelConverter(l)
las_obj = las.LASFile(lasfn)
converter = ExcelConverter(las_obj)
converter.write(xlsxfn)


Expand Down Expand Up @@ -132,10 +132,12 @@ def main_bulk():
xlsxfn = lasfn.lower().replace(".las", ".xlsx")
print("Converting %s -> %s" % (lasfn, xlsxfn))
try:
l = las.LASFile(lasfn, ignore_header_errors=args.ignore_header_errors)
converter = ExcelConverter(l)
las_obj = las.LASFile(lasfn, ignore_header_errors=args.ignore_header_errors)
converter = ExcelConverter(las_obj)
converter.write(xlsxfn)
except:
except Exception:
# https://www.flake8rules.com/rules/E722.html
# https://github.com/PyCQA/pycodestyle/issues/703
print(
"Failed to convert file. Error message:\n" + traceback.format_exc()
)
Expand Down

0 comments on commit 52c02ca

Please sign in to comment.