MCPcopy Create free account
hub / github.com/FSoft-AI4Code/HyperAgent / uri_to_path

Method uri_to_path

src/hyperagent/multilspy/multilspy_utils.py:75–85  ·  view source on GitHub ↗

Converts a URI to a file path. Works on both Linux and Windows. This method was obtained from https://stackoverflow.com/a/61922504

(uri: str)

Source from the content-addressed store, hash-verified

73 """
74 @staticmethod
75 def uri_to_path(uri: str) -> str:
76 """
77 Converts a URI to a file path. Works on both Linux and Windows.
78
79 This method was obtained from https://stackoverflow.com/a/61922504
80 """
81 from urllib.parse import urlparse, unquote
82 from urllib.request import url2pathname
83 parsed = urlparse(uri)
84 host = "{0}{0}{mnt}{0}".format(os.path.sep, mnt=parsed.netloc)
85 return os.path.normpath(os.path.join(host, url2pathname(unquote(parsed.path))))
86
87class FileUtils:
88 """

Callers 2

request_definitionMethod · 0.80
request_referencesMethod · 0.80

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected