robotcode-core 0.78.4__tar.gz → 0.80.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.
Files changed (35) hide show
  1. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/PKG-INFO +6 -6
  2. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/README.md +1 -1
  3. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/pyproject.toml +4 -4
  4. robotcode_core-0.80.0/src/robotcode/core/__version__.py +1 -0
  5. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/uri.py +27 -1
  6. robotcode_core-0.80.0/src/robotcode/core/utils/path.py +49 -0
  7. robotcode_core-0.78.4/src/robotcode/core/__version__.py +0 -1
  8. robotcode_core-0.78.4/src/robotcode/core/utils/path.py +0 -16
  9. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/.gitignore +0 -0
  10. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/LICENSE.txt +0 -0
  11. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/__init__.py +0 -0
  12. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/async_tools.py +0 -0
  13. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/concurrent.py +0 -0
  14. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/documents_manager.py +0 -0
  15. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/event.py +0 -0
  16. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/filewatcher.py +0 -0
  17. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/language.py +0 -0
  18. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/lsp/__init__.py +0 -0
  19. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/lsp/types.py +0 -0
  20. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/py.typed +0 -0
  21. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/text_document.py +0 -0
  22. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/types.py +0 -0
  23. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/__init__.py +0 -0
  24. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/caching.py +0 -0
  25. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/cli.py +0 -0
  26. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/dataclasses.py +0 -0
  27. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/debugpy.py +0 -0
  28. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/glob_path.py +0 -0
  29. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/inspect.py +0 -0
  30. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/logging.py +0 -0
  31. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/net.py +0 -0
  32. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/process.py +0 -0
  33. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/safe_eval.py +0 -0
  34. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/utils/version.py +0 -0
  35. {robotcode_core-0.78.4 → robotcode_core-0.80.0}/src/robotcode/core/workspace.py +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: robotcode-core
3
- Version: 0.78.4
3
+ Version: 0.80.0
4
4
  Summary: Some core classes for RobotCode
5
5
  Project-URL: Homepage, https://robotcode.io
6
6
  Project-URL: Donate, https://github.com/sponsors/d-biehl
7
- Project-URL: Documentation, https://github.com/d-biehl/robotcode#readme
8
- Project-URL: Changelog, https://github.com/d-biehl/robotcode/blob/main/CHANGELOG.md
9
- Project-URL: Issues, https://github.com/d-biehl/robotcode/issues
10
- Project-URL: Source, https://github.com/d-biehl/robotcode
7
+ Project-URL: Documentation, https://github.com/robotcodedev/robotcode#readme
8
+ Project-URL: Changelog, https://github.com/robotcodedev/robotcode/blob/main/CHANGELOG.md
9
+ Project-URL: Issues, https://github.com/robotcodedev/robotcode/issues
10
+ Project-URL: Source, https://github.com/robotcodedev/robotcode
11
11
  Author-email: Daniel Biehl <dbiehl@live.de>
12
12
  License: Apache-2.0
13
13
  License-File: LICENSE.txt
@@ -32,7 +32,7 @@ Description-Content-Type: text/markdown
32
32
 
33
33
  [![PyPI - Version](https://img.shields.io/pypi/v/robotcode-core.svg)](https://pypi.org/project/robotcode-core)
34
34
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/robotcode-core.svg)](https://pypi.org/project/robotcode-core)
35
- [![License](https://img.shields.io/github/license/d-biehl/robotcode?style=flat&logo=apache)](https://github.com/d-biehl/robotcode/blob/master/LICENSE.txt)
35
+ [![License](https://img.shields.io/github/license/robotcodedev/robotcode?style=flat&logo=apache)](https://github.com/robotcodedev/robotcode/blob/master/LICENSE.txt)
36
36
 
37
37
  -----
38
38
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![PyPI - Version](https://img.shields.io/pypi/v/robotcode-core.svg)](https://pypi.org/project/robotcode-core)
4
4
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/robotcode-core.svg)](https://pypi.org/project/robotcode-core)
5
- [![License](https://img.shields.io/github/license/d-biehl/robotcode?style=flat&logo=apache)](https://github.com/d-biehl/robotcode/blob/master/LICENSE.txt)
5
+ [![License](https://img.shields.io/github/license/robotcodedev/robotcode?style=flat&logo=apache)](https://github.com/robotcodedev/robotcode/blob/master/LICENSE.txt)
6
6
 
7
7
  -----
8
8
 
@@ -31,10 +31,10 @@ dynamic = ["version"]
31
31
  [project.urls]
32
32
  Homepage = "https://robotcode.io"
33
33
  Donate = "https://github.com/sponsors/d-biehl"
34
- Documentation = "https://github.com/d-biehl/robotcode#readme"
35
- Changelog = "https://github.com/d-biehl/robotcode/blob/main/CHANGELOG.md"
36
- Issues = "https://github.com/d-biehl/robotcode/issues"
37
- Source = "https://github.com/d-biehl/robotcode"
34
+ Documentation = "https://github.com/robotcodedev/robotcode#readme"
35
+ Changelog = "https://github.com/robotcodedev/robotcode/blob/main/CHANGELOG.md"
36
+ Issues = "https://github.com/robotcodedev/robotcode/issues"
37
+ Source = "https://github.com/robotcodedev/robotcode"
38
38
 
39
39
  [tool.hatch.version]
40
40
  path = "src/robotcode/core/__version__.py"
@@ -0,0 +1 @@
1
+ __version__ = "0.80.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().resolve())
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.4"
@@ -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