Skip to content

Commit

Permalink
use with_suffix for swap_ext
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Mar 11, 2024
1 parent 03c202c commit 6859d47
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions hancho.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ def swap_ext(name, new_ext):
if name is None:
return None
if is_atom(name):
name = Path(name)
return str(name.parent / name.stem) + new_ext
return Path(name).with_suffix(new_ext)
return [swap_ext(n, new_ext) for n in flatten(name)]


def mtime(filename):
"""Gets the file's mtime and tracks how many times we called it"""
this.mtime_calls += 1
Expand Down

0 comments on commit 6859d47

Please sign in to comment.