robotcode-core 2.7.0__tar.gz → 2.8.0.dev8__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-2.7.0 → robotcode_core-2.8.0.dev8}/.gitignore +4 -1
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/PKG-INFO +3 -2
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/pyproject.toml +1 -0
- robotcode_core-2.8.0.dev8/src/robotcode/core/__version__.py +1 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/concurrent.py +0 -1
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/event.py +16 -3
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/ignore_spec.py +35 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/text_document.py +19 -2
- robotcode_core-2.7.0/src/robotcode/core/__version__.py +0 -1
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/README.md +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/__init__.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/async_tools.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/documents_manager.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/filewatcher.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/language.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/lsp/__init__.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/lsp/types.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/py.typed +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/types.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/uri.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/__init__.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/caching.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/cli.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/dataclasses.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/debugpy.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/glob_path.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/inspect.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/logging.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/net.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/path.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/process.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/safe_eval.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/utils/version.py +0 -0
- {robotcode_core-2.7.0 → robotcode_core-2.8.0.dev8}/src/robotcode/core/workspace.py +0 -0
|
@@ -279,6 +279,9 @@ dist
|
|
|
279
279
|
# vuepress build output
|
|
280
280
|
.vuepress/dist
|
|
281
281
|
|
|
282
|
+
# Astro (documentation site)
|
|
283
|
+
docs/.astro/
|
|
284
|
+
|
|
282
285
|
# Serverless directories
|
|
283
286
|
.serverless/
|
|
284
287
|
|
|
@@ -339,7 +342,7 @@ bundled/libs
|
|
|
339
342
|
# .agents
|
|
340
343
|
.agents/
|
|
341
344
|
skills-lock.json
|
|
342
|
-
|
|
345
|
+
#.claude
|
|
343
346
|
|
|
344
347
|
# sarif files
|
|
345
348
|
/**/*.sarif.json
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: robotcode-core
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.8.0-dev.8
|
|
4
4
|
Summary: Some core classes for RobotCode
|
|
5
5
|
Project-URL: Homepage, https://robotcode.io
|
|
6
6
|
Project-URL: Donate, https://opencollective.com/robotcode
|
|
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
24
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
25
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
25
26
|
Classifier: Topic :: Utilities
|
|
@@ -18,6 +18,7 @@ classifiers = [
|
|
|
18
18
|
"Programming Language :: Python :: 3.12",
|
|
19
19
|
"Programming Language :: Python :: 3.13",
|
|
20
20
|
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Programming Language :: Python :: 3.15",
|
|
21
22
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
22
23
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
23
24
|
"Operating System :: OS Independent",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.8.0-dev.8"
|
|
@@ -228,7 +228,6 @@ def _create_task_in_thread(
|
|
|
228
228
|
_running_tasks[future] = thread
|
|
229
229
|
future.add_done_callback(_remove_future_from_running_tasks)
|
|
230
230
|
|
|
231
|
-
# TODO: don't set daemon=True because it can be deprecated in future pyhton versions
|
|
232
231
|
thread.daemon = True
|
|
233
232
|
return future, thread
|
|
234
233
|
|
|
@@ -31,16 +31,29 @@ class EventResultIteratorBase(Generic[_TParams, _TResult]):
|
|
|
31
31
|
|
|
32
32
|
self._listeners: MutableSet[weakref.ref[Any]] = set()
|
|
33
33
|
|
|
34
|
+
# The weak reference of a listener calls this when the listener dies. It refers to the event only weakly: a
|
|
35
|
+
# bound method of the event would make every event with a listener a reference cycle that only the garbage
|
|
36
|
+
# collector frees.
|
|
37
|
+
self_ref = weakref.ref(self)
|
|
38
|
+
|
|
39
|
+
def remove_dead_listener(ref: Any) -> None:
|
|
40
|
+
event = self_ref()
|
|
41
|
+
if event is not None:
|
|
42
|
+
event.__remove_listener(ref)
|
|
43
|
+
|
|
44
|
+
self.__remove_dead_listener = remove_dead_listener
|
|
45
|
+
|
|
34
46
|
def __remove_listener(self, ref: Any) -> None:
|
|
35
47
|
with self._lock:
|
|
36
|
-
|
|
48
|
+
# a listener that `remove` took out may die only afterwards, while another thread still iterates over it
|
|
49
|
+
self._listeners.discard(ref)
|
|
37
50
|
|
|
38
51
|
def add(self, callback: Callable[_TParams, _TResult]) -> None:
|
|
39
52
|
with self._lock:
|
|
40
53
|
if inspect.ismethod(callback):
|
|
41
|
-
self._listeners.add(weakref.WeakMethod(callback, self.
|
|
54
|
+
self._listeners.add(weakref.WeakMethod(callback, self.__remove_dead_listener))
|
|
42
55
|
else:
|
|
43
|
-
self._listeners.add(weakref.ref(callback, self.
|
|
56
|
+
self._listeners.add(weakref.ref(callback, self.__remove_dead_listener))
|
|
44
57
|
|
|
45
58
|
def remove(self, callback: Callable[_TParams, _TResult]) -> None:
|
|
46
59
|
with self._lock:
|
|
@@ -376,3 +376,38 @@ def _iter_files(
|
|
|
376
376
|
)
|
|
377
377
|
elif p.is_file():
|
|
378
378
|
yield p
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def iter_files_includes(
|
|
382
|
+
path: Path,
|
|
383
|
+
root: Path,
|
|
384
|
+
ignore_files: Iterable[str] = [GIT_IGNORE_FILE],
|
|
385
|
+
include_hidden: bool = True,
|
|
386
|
+
parent_spec: Optional[IgnoreSpec] = None,
|
|
387
|
+
) -> bool:
|
|
388
|
+
"""Whether `iter_files(root, ...)` with these arguments yields the file `path`, without walking other files.
|
|
389
|
+
|
|
390
|
+
It applies the ignore files of the folders on the way from `root` to `path` as `iter_files` does.
|
|
391
|
+
"""
|
|
392
|
+
path = Path(os.path.abspath(path))
|
|
393
|
+
root = Path(os.path.abspath(root))
|
|
394
|
+
if not path_is_relative_to(path, root) or not path.is_file():
|
|
395
|
+
return False
|
|
396
|
+
|
|
397
|
+
spec = parent_spec if parent_spec is not None else IgnoreSpec.from_list(DEFAULT_SPEC_RULES, root)
|
|
398
|
+
folder = root
|
|
399
|
+
for name in path.relative_to(root).parts:
|
|
400
|
+
ignore_file = next((folder / f for f in ignore_files if (folder / f).is_file()), None)
|
|
401
|
+
if ignore_file is not None:
|
|
402
|
+
spec = spec + IgnoreSpec.from_gitignore(ignore_file)
|
|
403
|
+
ignore_files = [ignore_file.name]
|
|
404
|
+
|
|
405
|
+
entry = folder / name
|
|
406
|
+
if not include_hidden and _is_hidden(entry):
|
|
407
|
+
return False
|
|
408
|
+
if spec.matches(entry):
|
|
409
|
+
return False
|
|
410
|
+
|
|
411
|
+
folder = entry
|
|
412
|
+
|
|
413
|
+
return True
|
|
@@ -128,6 +128,18 @@ class TextDocument:
|
|
|
128
128
|
self._data: weakref.WeakKeyDictionary[Any, Any] = weakref.WeakKeyDictionary()
|
|
129
129
|
self.opened_in_editor = False
|
|
130
130
|
|
|
131
|
+
# The weak reference of a cache entry calls this when the entry's function dies. It refers to the document
|
|
132
|
+
# only weakly: a bound method of the document would make every document with a cache entry a reference cycle
|
|
133
|
+
# that only the garbage collector frees.
|
|
134
|
+
self_ref = weakref.ref(self)
|
|
135
|
+
|
|
136
|
+
def remove_dead_cache_entry(ref: Any) -> None:
|
|
137
|
+
document = self_ref()
|
|
138
|
+
if document is not None:
|
|
139
|
+
document.__remove_cache_entry(ref)
|
|
140
|
+
|
|
141
|
+
self.__remove_dead_cache_entry = remove_dead_cache_entry
|
|
142
|
+
|
|
131
143
|
@property
|
|
132
144
|
def version(self) -> Optional[int]:
|
|
133
145
|
return self._version
|
|
@@ -159,6 +171,11 @@ class TextDocument:
|
|
|
159
171
|
def save(self, version: Optional[int], text: Optional[str]) -> None:
|
|
160
172
|
self.apply_full_change(version, text, save=True)
|
|
161
173
|
|
|
174
|
+
def mark_saved(self) -> None:
|
|
175
|
+
"""Remember the current text as the saved one, which `revert` returns to, without invalidating the caches."""
|
|
176
|
+
with self._lock:
|
|
177
|
+
self._orig_text = self._text
|
|
178
|
+
|
|
162
179
|
def revert(self, version: Optional[int]) -> bool:
|
|
163
180
|
if self._orig_text != self._text or self._orig_version != self._version:
|
|
164
181
|
self.apply_full_change(version or self._orig_version, self._orig_text)
|
|
@@ -344,9 +361,9 @@ class TextDocument:
|
|
|
344
361
|
|
|
345
362
|
def __get_cache_reference(self, entry: Callable[..., Any], /, *, add_remove: bool = True) -> "weakref.ref[Any]":
|
|
346
363
|
if inspect.ismethod(entry):
|
|
347
|
-
return weakref.WeakMethod(entry, self.
|
|
364
|
+
return weakref.WeakMethod(entry, self.__remove_dead_cache_entry if add_remove else None)
|
|
348
365
|
|
|
349
|
-
return weakref.ref(entry, self.
|
|
366
|
+
return weakref.ref(entry, self.__remove_dead_cache_entry if add_remove else None)
|
|
350
367
|
|
|
351
368
|
def get_cache_value(self, entry: Callable[[Self], _T]) -> Optional[_T]:
|
|
352
369
|
reference = self.__get_cache_reference(entry)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.7.0"
|
|
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
|