Skip to content

Commit

Permalink
checks: Flake8 F841 fixes in the scripts directory part 2 (#4241)
Browse files Browse the repository at this point in the history
* Fix F841 problems in `scripts` directory

* Update `.flake8` with fixes for F841

* Remove unused lines based on reviewed suggestions
  • Loading branch information
mshukuno authored Sep 7, 2024
1 parent 9bbfd6b commit 102bc38
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ per-file-ignores =
scripts/r.in.wms/wms_cap_parsers.py: F841
scripts/r.in.wms/wms_drv.py: E402, E722
scripts/r.in.wms/srs.py: E722
scripts/r.semantic.label/r.semantic.label.py: F841, E501
scripts/v.report/v.report.py: F841, E721
scripts/r.semantic.label/r.semantic.label.py: E501
scripts/v.report/v.report.py: E721
scripts/db.out.ogr/db.out.ogr.py: F841
scripts/g.extension/g.extension.py: F841, E722, E501
scripts/v.unpack/v.unpack.py: F841, E722, E501
scripts/v.import/v.import.py: F841, E722, E501
scripts/v.unpack/v.unpack.py: E722, E501
scripts/v.import/v.import.py: E722, E501
scripts/db.univar/db.univar.py: E501
scripts/d.frame/d.frame.py: E722
scripts/i.pansharpen/i.pansharpen.py: E722, E501
Expand Down
4 changes: 2 additions & 2 deletions scripts/r.semantic.label/r.semantic.label.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def print_map_semantic_label(name, label_reader):
label_reader.print_info(semantic_label=semantic_label)
else:
gs.info(_("No semantic label assigned to <{}>").format(name))
except OpenError as e:
except OpenError:
gs.error(_("Map <{}> not found").format(name))


Expand Down Expand Up @@ -94,7 +94,7 @@ def manage_map_semantic_label(name, semantic_label):
except GrassError as e:
gs.error(_("Unable to assign/dissociate semantic label. {}").format(e))
return 1
except OpenError as e:
except OpenError:
gs.error(_("Map <{}> not found in current mapset").format(name))
return 1

Expand Down
2 changes: 0 additions & 2 deletions scripts/v.import/v.import.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ def main():
f.write("GUI: text\n")
f.close()

tgtsrs = gs.read_command("g.proj", flags="j", quiet=True)

# create temp location from input without import
gs.verbose(_("Creating temporary project for <%s>...") % OGRdatasource)
try:
Expand Down
3 changes: 0 additions & 3 deletions scripts/v.report/v.report.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ def main():
if not flags["c"]:
sys.stdout.write(fs.join(colnames + extracolnames) + "\n")

# make and print the table:
numcols = len(colnames) + len(extracolnames)

# calculate percents if requested
if units == "percent" and option != "coor":
# calculate total value
Expand Down
4 changes: 0 additions & 4 deletions scripts/v.unpack/v.unpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ def main():
# the db connection in the output mapset
dbconn = grassdb.db_connection(force=True)
todb = dbconn["database"]
# return all tables
list_fromtable = grass.read_command(
"db.tables", driver="sqlite", database=fromdb
).splitlines()

# return the list of old connection for extract layer number and key
dbln = open(os.path.join(new_dir, "dbln"), "r")
Expand Down

0 comments on commit 102bc38

Please sign in to comment.