moat-src 0.8.4__py3-none-any.whl → 0.8.10__py3-none-any.whl

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 (27) hide show
  1. moat/src/_cfg.yaml +2 -0
  2. moat/src/_main.py +287 -197
  3. moat/src/_templates/moat/_main.py +23 -0
  4. moat/src/test.py +1 -1
  5. {moat_src-0.8.4.dist-info → moat_src-0.8.10.dist-info}/METADATA +2 -2
  6. moat_src-0.8.10.dist-info/RECORD +14 -0
  7. {moat_src-0.8.4.dist-info → moat_src-0.8.10.dist-info}/WHEEL +1 -1
  8. moat_src-0.8.10.dist-info/top_level.txt +1 -0
  9. build/lib/moat/src/__init__.py +0 -0
  10. build/lib/moat/src/_main.py +0 -1113
  11. build/lib/moat/src/_templates/moat/__init__.py +0 -3
  12. build/lib/moat/src/inspect.py +0 -65
  13. build/lib/moat/src/test.py +0 -89
  14. debian/moat-src/usr/lib/python3/dist-packages/moat/src/__init__.py +0 -0
  15. debian/moat-src/usr/lib/python3/dist-packages/moat/src/_main.py +0 -1113
  16. debian/moat-src/usr/lib/python3/dist-packages/moat/src/_templates/moat/__init__.py +0 -3
  17. debian/moat-src/usr/lib/python3/dist-packages/moat/src/_templates/pyproject.default.yaml +0 -146
  18. debian/moat-src/usr/lib/python3/dist-packages/moat/src/_templates/pyproject.forced.yaml +0 -77
  19. debian/moat-src/usr/lib/python3/dist-packages/moat/src/inspect.py +0 -65
  20. debian/moat-src/usr/lib/python3/dist-packages/moat/src/test.py +0 -89
  21. moat/src/_templates/pyproject.default.yaml +0 -146
  22. moat/src/_templates/pyproject.forced.yaml +0 -77
  23. moat_src-0.8.4.dist-info/RECORD +0 -26
  24. moat_src-0.8.4.dist-info/top_level.txt +0 -4
  25. {build/lib/moat/src/_templates → moat/src/_templates/packaging}/pyproject.default.yaml +0 -0
  26. {build/lib/moat/src/_templates → moat/src/_templates/packaging}/pyproject.forced.yaml +0 -0
  27. {moat_src-0.8.4.dist-info → moat_src-0.8.10.dist-info}/licenses/LICENSE.txt +0 -0
@@ -1,3 +0,0 @@
1
- from __future__ import annotations
2
-
3
- __path__ = __import__("pkgutil").extend_path(__path__, __name__)
@@ -1,65 +0,0 @@
1
- """
2
- This Trio inspector is geared towards figuring out why the *censored* a
3
- task is cancelled when no exception shows up.
4
-
5
- """
6
-
7
- from __future__ import annotations
8
-
9
- import inspect
10
- import logging
11
-
12
- from asyncscope import scope as sc
13
-
14
- logger = logging.getLogger("trio.inspect")
15
-
16
-
17
- def debug(*a):
18
- "logging helper"
19
- s = sc.get()
20
- (logger if s is None else s.logger).debug(*a)
21
-
22
-
23
- class CancelTracer:
24
- """A Trio inspect module that helps tracking cancel scopes"""
25
-
26
- # pylint: disable=missing-function-docstring,protected-access
27
- def __init__(self):
28
- pass
29
-
30
- def skip(self, scope):
31
- if scope._stack is None:
32
- return True
33
- if scope._stack[5].f_code.co_name == "connect_tcp":
34
- return True
35
- return False
36
-
37
- def scope_entered(self, scope):
38
- scope._stack = s = []
39
- f = inspect.currentframe().f_back
40
- while f:
41
- s.append(f)
42
- f = f.f_back
43
-
44
- if self.skip(scope):
45
- return
46
-
47
- debug("EnterCS %r", scope)
48
-
49
- def scope_exited(self, scope):
50
- if self.skip(scope):
51
- return
52
- debug("ExitCS %r", scope)
53
-
54
- def scope_cancelled(self, scope, reason):
55
- if self.skip(scope):
56
- return
57
- # if reason.value == 0:
58
- # breakpoint()
59
- debug("KillCS %r %s", scope, reason.name)
60
-
61
- def task_spawned(self, task):
62
- debug("EnterT %r", task)
63
-
64
- def task_exited(self, task):
65
- debug("ExitT %r", task)
@@ -1,89 +0,0 @@
1
- """
2
- MoaT test support
3
- """
4
-
5
- from __future__ import annotations
6
-
7
- import io
8
- import logging
9
- import shlex
10
- import sys
11
- from contextlib import contextmanager
12
-
13
- from asyncscope import main_scope, scope
14
- from moat.util import OptCtx, attrdict, wrap_main # pylint:disable=no-name-in-module
15
-
16
- logger = logging.getLogger(__name__)
17
-
18
-
19
- async def run(*args, expect_exit=0, do_stdout=True):
20
- """Call a MoaT command handler"""
21
- args = ("-c", "/dev/null", *args)
22
- CFG = {} # load_cfg("moat")
23
-
24
- if do_stdout:
25
- CFG["_stdout"] = out = io.StringIO()
26
- logger.debug(" moat %s", " ".join(shlex.quote(str(x)) for x in args))
27
- try:
28
- res = None
29
- async with (
30
- OptCtx(main_scope(name="run") if scope.get() is None else None),
31
- scope.using_scope(),
32
- ):
33
- res = await wrap_main(
34
- args=args,
35
- wrap=True,
36
- CFG=CFG,
37
- cfg=False,
38
- name="moat",
39
- sub_pre="moat",
40
- sub_post="_main.cli",
41
- )
42
- if res is None:
43
- res = attrdict()
44
- return res
45
- except SystemExit as exc:
46
- res = exc
47
- assert exc.code == expect_exit, exc.code
48
- return exc
49
- except Exception as exc:
50
- while isinstance(exc, ExceptionGroup) and len(exc.exceptions) == 1:
51
- exc = exc.exceptions[0]
52
- raise exc
53
- except BaseException as exc:
54
- res = exc
55
- raise
56
- else:
57
- assert expect_exit == 0
58
- return res
59
- finally:
60
- if do_stdout:
61
- if res is not None:
62
- res.stdout = out.getvalue()
63
- CFG["_stdout"] = sys.stdout
64
-
65
-
66
- class DidNotRaise(Exception):
67
- pass
68
-
69
-
70
- @contextmanager
71
- def raises(*exc):
72
- """
73
- Like pytest.raises, but handles exception groups
74
- """
75
- res = attrdict()
76
- try:
77
- yield res
78
- except exc as e:
79
- res.value = e
80
- except ExceptionGroup as e:
81
- while isinstance(e, ExceptionGroup) and len(e.exceptions) == 1:
82
- e = e.exceptions[0]
83
- res.value = e
84
- if isinstance(e, exc):
85
- return
86
- raise
87
- else:
88
- res.value = None
89
- raise DidNotRaise(exc)