add route combination
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pickle
|
||||
import re
|
||||
import shutil
|
||||
from collections.abc import Sequence
|
||||
from pathlib import Path
|
||||
@@ -95,6 +96,16 @@ def prepare_path(
|
||||
return (pth_parent / filename).with_suffix(suffix)
|
||||
|
||||
|
||||
def _strip_url_components(string: str) -> str:
|
||||
return re.sub(r"^[ /]+|[ /]+$", "", string)
|
||||
|
||||
|
||||
def combine_route(base_url: str, route: str) -> str:
|
||||
base_url = _strip_url_components(base_url)
|
||||
route = _strip_url_components(route)
|
||||
return "/".join((base_url, route))
|
||||
|
||||
|
||||
def search_cwd(
|
||||
glob_pattern: str,
|
||||
) -> Path | None:
|
||||
|
||||
Reference in New Issue
Block a user