mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
♻️ move splitext to lib
This commit is contained in:
parent
71caefe449
commit
df2f68db97
2 changed files with 30 additions and 14 deletions
|
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import os
|
||||
import uuid
|
||||
import logging
|
||||
from contextlib import contextmanager
|
||||
|
|
@ -556,4 +557,24 @@ def get_frame_data(node):
|
|||
data["frameEnd"] = node.evalParm("f2")
|
||||
data["steps"] = node.evalParm("f3")
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
|
||||
def splitext(name, allowed_multidot_extensions):
|
||||
# type: (str, list) -> tuple
|
||||
"""Split file name to name and extension.
|
||||
|
||||
Args:
|
||||
name (str): File name to split.
|
||||
allowed_multidot_extensions (list of str): List of allowed multidot
|
||||
extensions.
|
||||
|
||||
Returns:
|
||||
tuple: Name and extension.
|
||||
"""
|
||||
|
||||
for ext in allowed_multidot_extensions:
|
||||
if name.endswith(ext):
|
||||
return name[:-len(ext)], ext
|
||||
|
||||
return os.path.splitext(name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue