Skip to content

Commit

Permalink
Avoid extra call of safe_path in file_extension() (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw authored Jan 15, 2024
1 parent fe06fcf commit 27c1eb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions audiofile/core/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import subprocess
import typing

import numpy as np

import audeer
import audmath


Expand Down Expand Up @@ -76,7 +76,9 @@ def duration_in_seconds(

def file_extension(path):
"""Lower case file extension."""
return audeer.file_extension(path).lower()
# We are not using `audeer.file_extension()` here,
# to save another call to `audeer.safe_path()`
return os.path.splitext(path)[-1][1:].lower()


def run(shell_command):
Expand Down

0 comments on commit 27c1eb9

Please sign in to comment.