robotcode-core 0.78.2__tar.gz → 0.79.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/PKG-INFO +1 -1
- robotcode_core-0.79.0/src/robotcode/core/__version__.py +1 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/uri.py +27 -1
- robotcode_core-0.79.0/src/robotcode/core/utils/path.py +49 -0
- robotcode_core-0.78.2/src/robotcode/core/__version__.py +0 -1
- robotcode_core-0.78.2/src/robotcode/core/utils/path.py +0 -16
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/.gitignore +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/LICENSE.txt +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/README.md +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/pyproject.toml +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/__init__.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/async_tools.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/concurrent.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/documents_manager.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/event.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/filewatcher.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/language.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/lsp/__init__.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/lsp/types.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/py.typed +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/text_document.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/types.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/__init__.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/caching.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/cli.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/dataclasses.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/debugpy.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/glob_path.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/inspect.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/logging.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/net.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/process.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/safe_eval.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/utils/version.py +0 -0
- {robotcode_core-0.78.2 → robotcode_core-0.79.0}/src/robotcode/core/workspace.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.79.0"
|
|
@@ -7,6 +7,8 @@ from pathlib import Path
|
|
|
7
7
|
from typing import Any, Iterator, Mapping, Optional, Union, overload
|
|
8
8
|
from urllib import parse
|
|
9
9
|
|
|
10
|
+
from .utils.path import normalized_path
|
|
11
|
+
|
|
10
12
|
_IS_WIN = os.name == "nt"
|
|
11
13
|
|
|
12
14
|
_RE_DRIVE_LETTER_PATH = re.compile(r"^\/[a-zA-Z]:")
|
|
@@ -158,6 +160,10 @@ class Uri(Mapping[str, str]):
|
|
|
158
160
|
def query(self) -> str:
|
|
159
161
|
return self._parts.query
|
|
160
162
|
|
|
163
|
+
@property
|
|
164
|
+
def fragment(self) -> str:
|
|
165
|
+
return self._parts.fragment
|
|
166
|
+
|
|
161
167
|
@staticmethod
|
|
162
168
|
def from_path(path: Union[str, Path, os.PathLike[str]]) -> Uri:
|
|
163
169
|
result = Uri(Path(path).as_uri())
|
|
@@ -188,6 +194,26 @@ class Uri(Mapping[str, str]):
|
|
|
188
194
|
|
|
189
195
|
def normalized(self) -> Uri:
|
|
190
196
|
if self.scheme == "file":
|
|
191
|
-
return Uri.from_path(self.to_path()
|
|
197
|
+
return Uri.from_path(normalized_path(self.to_path()))
|
|
192
198
|
|
|
193
199
|
return Uri(str(self))
|
|
200
|
+
|
|
201
|
+
def change(
|
|
202
|
+
self,
|
|
203
|
+
*,
|
|
204
|
+
scheme: Optional[str] = None,
|
|
205
|
+
netloc: Optional[str] = None,
|
|
206
|
+
path: Optional[str] = None,
|
|
207
|
+
params: Optional[str] = None,
|
|
208
|
+
query: Optional[str] = None,
|
|
209
|
+
fragment: Optional[str] = None,
|
|
210
|
+
) -> Uri:
|
|
211
|
+
|
|
212
|
+
return Uri(
|
|
213
|
+
scheme=scheme if scheme is not None else self.scheme,
|
|
214
|
+
netloc=netloc if netloc is not None else self.netloc,
|
|
215
|
+
path=path if path is not None else self.path,
|
|
216
|
+
params=params if params is not None else self.params,
|
|
217
|
+
query=query if query is not None else self.query,
|
|
218
|
+
fragment=fragment if fragment is not None else self.fragment,
|
|
219
|
+
)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any, Union
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def path_is_relative_to(
|
|
8
|
+
path: Union[Path, str, "os.PathLike[Any]"],
|
|
9
|
+
other_path: Union[Path, str, "os.PathLike[Any]"],
|
|
10
|
+
) -> bool:
|
|
11
|
+
try:
|
|
12
|
+
Path(path).relative_to(other_path)
|
|
13
|
+
return True
|
|
14
|
+
except ValueError:
|
|
15
|
+
return False
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
_RE_DRIVE_LETTER_PATH = re.compile(r"^[a-zA-Z]:")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def normalized_path(path: Union[Path, str, "os.PathLike[Any]"]) -> Path:
|
|
22
|
+
p = os.path.normpath(os.path.abspath(path))
|
|
23
|
+
|
|
24
|
+
if os.name == "nt" and _RE_DRIVE_LETTER_PATH.match(str(p)):
|
|
25
|
+
return Path(p[0].upper() + p[1:])
|
|
26
|
+
|
|
27
|
+
return Path(p)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def normalized_path_full(path: Union[Path, str, "os.PathLike[Any]"]) -> Path:
|
|
31
|
+
p = normalized_path(path)
|
|
32
|
+
|
|
33
|
+
orig_parents = list(reversed(p.parents))
|
|
34
|
+
orig_parents.append(p)
|
|
35
|
+
|
|
36
|
+
parents = []
|
|
37
|
+
for index, parent in enumerate(orig_parents):
|
|
38
|
+
if parent.exists():
|
|
39
|
+
ps = (
|
|
40
|
+
next((f.name for f in parent.parent.iterdir() if f.samefile(parent)), None)
|
|
41
|
+
if parent.parent is not None and parent.parent != parent
|
|
42
|
+
else parent.name or parent.anchor
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
parents.append(ps if ps is not None else parent.name)
|
|
46
|
+
else:
|
|
47
|
+
return Path(*parents, *[f.name for f in orig_parents[index:]])
|
|
48
|
+
|
|
49
|
+
return Path(*parents)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.78.2"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from os import PathLike
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from typing import Any, Union
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def path_is_relative_to(
|
|
9
|
-
path: Union[Path, str, PathLike[Any]],
|
|
10
|
-
other_path: Union[Path, str, PathLike[Any]],
|
|
11
|
-
) -> bool:
|
|
12
|
-
try:
|
|
13
|
-
Path(path).relative_to(other_path)
|
|
14
|
-
return True
|
|
15
|
-
except ValueError:
|
|
16
|
-
return False
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|