MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / get_file_name

Function get_file_name

scenedetect/platform.py:129–138  ·  view source on GitHub ↗

Return the file name that `file_path` refers to, optionally removing the extension. E.g. /tmp/foo.bar -> foo

(file_path: StrPath, include_extension: bool = True)

Source from the content-addressed store, hash-verified

127
128
129def get_file_name(file_path: StrPath, include_extension: bool = True) -> str:
130 """Return the file name that `file_path` refers to, optionally removing the extension.
131
132 E.g. /tmp/foo.bar -> foo"""
133 file_name = os.path.basename(os.fspath(file_path))
134 if not include_extension:
135 last_dot_pos = file_name.rfind(".")
136 if last_dot_pos >= 0:
137 file_name = file_name[:last_dot_pos]
138 return file_name
139
140
141def get_and_create_path(file_path: StrPath, output_directory: StrPath | None = None) -> str:

Callers 3

__init__Method · 0.90
nameMethod · 0.90
nameMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected