PyEventEngine 0.6.0.post3__cp313-cp313-win_amd64.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 (52) hide show
  1. event_engine/__infra__.pxd +2 -0
  2. event_engine/__init__.pxd +2 -0
  3. event_engine/__init__.py +37 -0
  4. event_engine/base/__infra__.pxd +9 -0
  5. event_engine/base/__init__.pxd +9 -0
  6. event_engine/base/__init__.py +82 -0
  7. event_engine/base/c_allocator_protocol.c +10817 -0
  8. event_engine/base/c_allocator_protocol.cp313-win_amd64.pyd +0 -0
  9. event_engine/base/c_allocator_protocol.h +23 -0
  10. event_engine/base/c_allocator_protocol.pxd +31 -0
  11. event_engine/base/c_allocator_protocol.pyx +99 -0
  12. event_engine/capi/__infra__.pxd +189 -0
  13. event_engine/capi/__init__.pxd +189 -0
  14. event_engine/capi/__init__.py +84 -0
  15. event_engine/capi/c_engine.c +28711 -0
  16. event_engine/capi/c_engine.cp313-win_amd64.pyd +0 -0
  17. event_engine/capi/c_engine.h +393 -0
  18. event_engine/capi/c_engine.pxd +84 -0
  19. event_engine/capi/c_engine.pyi +424 -0
  20. event_engine/capi/c_engine.pyx +560 -0
  21. event_engine/capi/c_event.c +19921 -0
  22. event_engine/capi/c_event.cp313-win_amd64.pyd +0 -0
  23. event_engine/capi/c_event.h +342 -0
  24. event_engine/capi/c_event.pxd +159 -0
  25. event_engine/capi/c_event.pyi +226 -0
  26. event_engine/capi/c_event.pyx +387 -0
  27. event_engine/capi/c_topic.c +30978 -0
  28. event_engine/capi/c_topic.cp313-win_amd64.pyd +0 -0
  29. event_engine/capi/c_topic.h +1007 -0
  30. event_engine/capi/c_topic.pxd +147 -0
  31. event_engine/capi/c_topic.pyi +580 -0
  32. event_engine/capi/c_topic.pyx +725 -0
  33. event_engine/capi/fallback_engine.py +670 -0
  34. event_engine/includes/event_engine/base/c_allocator_protocol.c +10817 -0
  35. event_engine/includes/event_engine/base/c_allocator_protocol.h +23 -0
  36. event_engine/includes/event_engine/capi/c_engine.c +28711 -0
  37. event_engine/includes/event_engine/capi/c_engine.h +393 -0
  38. event_engine/includes/event_engine/capi/c_event.c +19921 -0
  39. event_engine/includes/event_engine/capi/c_event.h +342 -0
  40. event_engine/includes/event_engine/capi/c_topic.c +30978 -0
  41. event_engine/includes/event_engine/capi/c_topic.h +1007 -0
  42. event_engine/native/__init__.py +60 -0
  43. event_engine/native/_event.py +420 -0
  44. event_engine/native/_topic.py +171 -0
  45. event_engine/native/engine.py +746 -0
  46. event_engine/native/event.py +467 -0
  47. event_engine/native/topic.py +945 -0
  48. pyeventengine-0.6.0.post3.dist-info/METADATA +189 -0
  49. pyeventengine-0.6.0.post3.dist-info/RECORD +52 -0
  50. pyeventengine-0.6.0.post3.dist-info/WHEEL +5 -0
  51. pyeventengine-0.6.0.post3.dist-info/licenses/LICENSE +21 -0
  52. pyeventengine-0.6.0.post3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2 @@
1
+ from .base cimport *
2
+ from .capi cimport *
@@ -0,0 +1,2 @@
1
+ from .base cimport *
2
+ from .capi cimport *
@@ -0,0 +1,37 @@
1
+ __version__ = '0.6.0.post3'
2
+
3
+ import functools
4
+ import pathlib
5
+
6
+ try:
7
+ from .capi import * # noqa: F401,F403
8
+ except Exception as e:
9
+ import warnings
10
+
11
+ warnings.warn(
12
+ f"Failed to import event_engine.capi ({e!r}); falling back to event_engine.native.",
13
+ ImportWarning,
14
+ stacklevel=2,
15
+ )
16
+ from .native import * # noqa: F401,F403
17
+
18
+
19
+ @functools.cache
20
+ def get_include() -> list[str]:
21
+ import os
22
+ from .base import LOGGER
23
+
24
+ res_dir = pathlib.Path(__file__).parent
25
+ LOGGER.info(f'Building with <PyEventEngine> version: "{__version__}", resource directory: "{res_dir}".')
26
+
27
+ scr_dir = [
28
+ os.path.realpath(res_dir),
29
+ os.path.realpath(res_dir / 'base'),
30
+ os.path.realpath(res_dir / 'capi'),
31
+ ]
32
+
33
+ include_root = os.path.realpath(res_dir / 'includes')
34
+ if os.path.isdir(include_root):
35
+ scr_dir.append(include_root)
36
+
37
+ return scr_dir
@@ -0,0 +1,9 @@
1
+ from .c_allocator_protocol cimport (
2
+ EE_LOCAL_ONLY,
3
+
4
+ EE_CFG_LOCKED, EE_CFG_SHARED, EE_CFG_FREELIST,
5
+ EEConfigContext,
6
+ EE_HEAP_ALLOCATOR_RAW, EE_SHM_ALLOCATOR_RAW,
7
+ EE_DEFAULT_ALLOCATOR, EE_SHM_ALLOCATOR, EE_HEAP_ALLOCATOR,
8
+ EE_SHARED, EE_LOCKED, EE_LOCKFREE, EE_FREELIST,
9
+ )
@@ -0,0 +1,9 @@
1
+ from .c_allocator_protocol cimport (
2
+ EE_LOCAL_ONLY,
3
+
4
+ EE_CFG_LOCKED, EE_CFG_SHARED, EE_CFG_FREELIST,
5
+ EEConfigContext,
6
+ EE_HEAP_ALLOCATOR_RAW, EE_SHM_ALLOCATOR_RAW,
7
+ EE_DEFAULT_ALLOCATOR, EE_SHM_ALLOCATOR, EE_HEAP_ALLOCATOR,
8
+ EE_SHARED, EE_LOCKED, EE_LOCKFREE, EE_FREELIST,
9
+ )
@@ -0,0 +1,82 @@
1
+ import logging
2
+ import sys
3
+ import time
4
+
5
+ LOGGER: logging.Logger | None = None
6
+ DEBUG = False
7
+ LOG_LEVEL = logging.INFO
8
+ LOG_LEVEL_EVENT = LOG_LEVEL - 5
9
+
10
+
11
+ class ColoredFormatter(logging.Formatter):
12
+ """Logging Formatter to add colors and count warning / errors"""
13
+
14
+ def __init__(self, fmt=None, datefmt=None, style='{', validate=True):
15
+ self.format_str = '[{asctime} {name} - {threadName} - {module}:{lineno} - {levelname}] {message}' if fmt is None else fmt
16
+ self.date_fmt = '%Y-%m-%d %H:%M:%S' if datefmt is None else datefmt
17
+ self.style = style
18
+
19
+ super().__init__(fmt=fmt, datefmt=datefmt, style=style, validate=validate)
20
+
21
+ def _get_format(self, level: int, select=False):
22
+ bold_red = f"\33[31;1;3;4{';7' if select else ''}m"
23
+ red = f"\33[31;1{';7' if select else ''}m"
24
+ green = f"\33[32;1{';7' if select else ''}m"
25
+ yellow = f"\33[33;1{';7' if select else ''}m"
26
+ blue = f"\33[34;1{';7' if select else ''}m"
27
+ reset = "\33[0m"
28
+
29
+ if level <= logging.NOTSET:
30
+ fmt = self.format_str
31
+ elif level <= logging.DEBUG:
32
+ fmt = blue + self.format_str + reset
33
+ elif level <= logging.INFO:
34
+ fmt = green + self.format_str + reset
35
+ elif level <= logging.WARNING:
36
+ fmt = yellow + self.format_str + reset
37
+ elif level <= logging.ERROR:
38
+ fmt = red + self.format_str + reset
39
+ else:
40
+ fmt = bold_red + self.format_str + reset
41
+
42
+ return fmt
43
+
44
+ def format(self, record):
45
+ log_fmt = self._get_format(level=record.levelno)
46
+ formatter = logging.Formatter(log_fmt, datefmt=self.date_fmt, style=self.style)
47
+ return formatter.format(record)
48
+
49
+
50
+ def get_logger(**kwargs) -> logging.Logger:
51
+ level = kwargs.get('level', LOG_LEVEL)
52
+ stream_io = kwargs.get('stream_io', sys.stdout)
53
+ formatter = kwargs.get('formatter', ColoredFormatter())
54
+ global LOGGER
55
+
56
+ if LOGGER is not None:
57
+ return LOGGER
58
+
59
+ LOGGER = logging.getLogger('EventEngine')
60
+ LOGGER.setLevel(level)
61
+ logging.Formatter.converter = time.gmtime
62
+
63
+ if stream_io:
64
+ have_handler = False
65
+ for handler in LOGGER.handlers:
66
+ # noinspection PyUnresolvedReferences
67
+ if type(handler) == logging.StreamHandler and handler.stream == stream_io:
68
+ have_handler = True
69
+ break
70
+
71
+ if not have_handler:
72
+ logger_ch = logging.StreamHandler(stream=stream_io)
73
+ logger_ch.setLevel(level=level)
74
+ logger_ch.setFormatter(fmt=formatter)
75
+ LOGGER.addHandler(logger_ch)
76
+
77
+ return LOGGER
78
+
79
+
80
+ _ = get_logger()
81
+
82
+ __all__ = ['LOG_LEVEL_EVENT', 'LOGGER']