Skip to content

Commit

Permalink
style: Avoid double calls of os.path.split (#3811)
Browse files Browse the repository at this point in the history
Shorter, nicer and also performs little better.
  • Loading branch information
pesekon2 authored Jun 15, 2024
1 parent ca553a5 commit b3f9812
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions display/d.mon/render_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
# remove empty mapfile from non-rendering modules
def remove_mapfile(mapfile):
# adopted from Map.DeleteLayer() in gui/wxpython/core/render.py
base = os.path.split(mapfile)[0]
mapfile = os.path.split(mapfile)[1]
base, mapfile = os.path.split(mapfile)
tempbase = mapfile.split(".")[0]
if base == "" or tempbase == "":
return
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/core/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -1441,8 +1441,7 @@ def DeleteLayer(self, layer, overlay=False):

if layer in list:
if layer.mapfile:
base = os.path.split(layer.mapfile)[0]
mapfile = os.path.split(layer.mapfile)[1]
base, mapfile = os.path.split(layer.mapfile)
tempbase = mapfile.split(".")[0]
if base == "" or tempbase == "":
return None
Expand Down

0 comments on commit b3f9812

Please sign in to comment.