MCPcopy
hub / github.com/beetbox/beets / abs_query_path

Method abs_query_path

test/test_query.py:319–333  ·  view source on GitHub ↗

Build a platform-correct absolute query path without normalizing it. On Windows, leading-slash paths are drive-rooted but Python 3.13 no longer treats them as absolute. Prefix the current drive so explicit path queries stay absolute while preserving raw segments such as ``..

(path: str, trailing_sep: bool = False)

Source from the content-addressed store, hash-verified

317
318 @staticmethod
319 def abs_query_path(path: str, trailing_sep: bool = False) -> str:
320 """Build a platform-correct absolute query path without normalizing it.
321
322 On Windows, leading-slash paths are drive-rooted but Python 3.13 no
323 longer treats them as absolute. Prefix the current drive so explicit
324 path queries stay absolute while preserving raw segments such as ``..``.
325 """
326 if os.path.__name__ == "ntpath" and path.startswith("/"):
327 drive, _ = os.path.splitdrive(os.fsdecode(util.normpath(os.sep)))
328 path = drive + path
329
330 path = path.replace("/", os.sep)
331 if trailing_sep:
332 path = os.path.join(path, "")
333 return path.replace("\\", "\\\\")
334
335 @pytest.fixture(scope="class")
336 def lib(self, helper):

Callers 2

test_explicitMethod · 0.95
test_case_sensitivityMethod · 0.95

Calls 2

replaceMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected