robotcode-core 0.91.0__tar.gz → 0.93.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.91.0 → robotcode_core-0.93.0}/.gitignore +2 -0
  2. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/PKG-INFO +1 -1
  3. robotcode_core-0.93.0/src/robotcode/core/__version__.py +1 -0
  4. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/ignore_spec.py +6 -0
  5. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/text_document.py +9 -0
  6. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/logging.py +51 -1
  7. robotcode_core-0.91.0/src/robotcode/core/__version__.py +0 -1
  8. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/LICENSE.txt +0 -0
  9. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/README.md +0 -0
  10. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/pyproject.toml +0 -0
  11. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/__init__.py +0 -0
  12. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/async_tools.py +0 -0
  13. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/concurrent.py +0 -0
  14. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/documents_manager.py +0 -0
  15. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/event.py +0 -0
  16. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/filewatcher.py +0 -0
  17. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/language.py +0 -0
  18. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/lsp/__init__.py +0 -0
  19. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/lsp/types.py +0 -0
  20. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/py.typed +0 -0
  21. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/types.py +0 -0
  22. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/uri.py +0 -0
  23. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/__init__.py +0 -0
  24. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/caching.py +0 -0
  25. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/cli.py +0 -0
  26. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/dataclasses.py +0 -0
  27. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/debugpy.py +0 -0
  28. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/glob_path.py +0 -0
  29. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/inspect.py +0 -0
  30. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/net.py +0 -0
  31. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/path.py +0 -0
  32. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/process.py +0 -0
  33. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/safe_eval.py +0 -0
  34. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/utils/version.py +0 -0
  35. {robotcode_core-0.91.0 → robotcode_core-0.93.0}/src/robotcode/core/workspace.py +0 -0
@@ -282,6 +282,8 @@ playground/
282
282
  test-results
283
283
  results.html
284
284
  report.html
285
+ log.html
286
+ output.xml
285
287
 
286
288
  # pyenv
287
289
  .python-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: robotcode-core
3
- Version: 0.91.0
3
+ Version: 0.93.0
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
@@ -0,0 +1 @@
1
+ __version__ = "0.93.0"
@@ -288,6 +288,7 @@ def iter_files(
288
288
  include_hidden: bool = True,
289
289
  parent_spec: Optional[IgnoreSpec] = None,
290
290
  verbose_callback: Optional[Callable[[str], None]] = None,
291
+ verbose_trace: bool = False,
291
292
  ) -> Iterator[Path]:
292
293
  if isinstance(paths, Path):
293
294
  paths = [paths]
@@ -300,6 +301,7 @@ def iter_files(
300
301
  include_hidden=include_hidden,
301
302
  parent_spec=parent_spec,
302
303
  verbose_callback=verbose_callback,
304
+ verbose_trace=verbose_trace,
303
305
  )
304
306
 
305
307
 
@@ -310,7 +312,10 @@ def _iter_files(
310
312
  include_hidden: bool = True,
311
313
  parent_spec: Optional[IgnoreSpec] = None,
312
314
  verbose_callback: Optional[Callable[[str], None]] = None,
315
+ verbose_trace: bool = False,
313
316
  ) -> Iterator[Path]:
317
+ if verbose_callback is not None and verbose_trace:
318
+ verbose_callback(f"iter_files: {path}")
314
319
 
315
320
  if root is None:
316
321
  root = path if path.is_dir() else path.parent
@@ -368,6 +373,7 @@ def _iter_files(
368
373
  include_hidden=include_hidden,
369
374
  parent_spec=spec,
370
375
  verbose_callback=verbose_callback,
376
+ verbose_trace=verbose_trace,
371
377
  )
372
378
  elif p.is_file():
373
379
  yield p
@@ -1,4 +1,5 @@
1
1
  import collections
2
+ import functools
2
3
  import inspect
3
4
  import io
4
5
  import weakref
@@ -47,10 +48,18 @@ def position_from_utf16(lines: List[str], position: Position) -> Position:
47
48
  return Position(line=position.line, character=utf32_offset)
48
49
 
49
50
 
51
+ @functools.lru_cache(maxsize=2048)
52
+ def has_multibyte_char(line: str) -> bool:
53
+ return any(is_multibyte_char(c) for c in line)
54
+
55
+
50
56
  def position_to_utf16(lines: List[str], position: Position) -> Position:
51
57
  if position.line >= len(lines):
52
58
  return position
53
59
 
60
+ if not has_multibyte_char(lines[position.line]):
61
+ return position
62
+
54
63
  utf16_counter = 0
55
64
 
56
65
  for i, c in enumerate(lines[position.line]):
@@ -7,11 +7,14 @@ import logging
7
7
  import os
8
8
  import reprlib
9
9
  import time
10
+ from contextlib import contextmanager
10
11
  from enum import Enum
11
12
  from typing import (
12
13
  Any,
13
14
  Callable,
14
15
  ClassVar,
16
+ Dict,
17
+ Iterator,
15
18
  List,
16
19
  Optional,
17
20
  Type,
@@ -188,12 +191,19 @@ class LoggingDescriptor:
188
191
  condition: Optional[Callable[[], bool]] = None,
189
192
  *args: Any,
190
193
  stacklevel: int = 2,
194
+ context_name: Optional[str] = None,
191
195
  **kwargs: Any,
192
196
  ) -> None:
193
197
  if self.is_enabled_for(level) and condition is not None and condition() or condition is None:
198
+ depth = 0
199
+ if context_name is not None:
200
+ depth = self._measure_contexts.get(context_name, 0)
201
+
202
+ msg = (" " * depth) + (msg() if callable(msg) else msg)
203
+
194
204
  self.logger.log(
195
205
  level,
196
- msg() if callable(msg) else msg,
206
+ msg,
197
207
  *args,
198
208
  stacklevel=stacklevel,
199
209
  **kwargs,
@@ -216,6 +226,46 @@ class LoggingDescriptor:
216
226
  **kwargs,
217
227
  )
218
228
 
229
+ _log_measure_time = log
230
+ _measure_contexts: Dict[str, int] = {}
231
+
232
+ @contextmanager
233
+ def measure_time(
234
+ self,
235
+ msg: Union[str, Callable[[], str]],
236
+ *args: Any,
237
+ level: int = logging.DEBUG,
238
+ context_name: Optional[str] = None,
239
+ **kwargs: Any,
240
+ ) -> Iterator[None]:
241
+ if self.is_enabled_for(level):
242
+ depth = 0
243
+
244
+ if context_name is not None:
245
+ depth = self._measure_contexts.get(context_name, 0)
246
+
247
+ self._measure_contexts[context_name] = depth + 1
248
+
249
+ self._log_measure_time(level, f"{' '*depth}Start {msg() if callable(msg) else msg}", *args, **kwargs)
250
+
251
+ start_time = time.monotonic()
252
+ try:
253
+ yield
254
+ finally:
255
+ duration = time.monotonic() - start_time
256
+
257
+ if context_name is not None:
258
+ self._measure_contexts[context_name] = depth
259
+
260
+ self._log_measure_time(
261
+ level,
262
+ f"{' '*depth}End {msg() if callable(msg) else msg} took {duration} seconds",
263
+ *args,
264
+ **kwargs,
265
+ )
266
+ else:
267
+ yield
268
+
219
269
  def info(
220
270
  self,
221
271
  msg: Union[str, Callable[[], str]],
@@ -1 +0,0 @@
1
- __version__ = "0.91.0"