funboost 44.8__py3-none-any.whl → 45.0__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.

Potentially problematic release.


This version of funboost might be problematic. Click here for more details.

Files changed (78) hide show
  1. funboost/__init__.py +1 -1
  2. funboost/constant.py +14 -4
  3. funboost/consumers/base_consumer.py +48 -20
  4. funboost/core/booster.py +15 -0
  5. funboost/core/current_task.py +88 -69
  6. funboost/core/func_params_model.py +8 -0
  7. funboost/function_result_web/__pycache__/functions.cpython-39.pyc +0 -0
  8. funboost/publishers/base_publisher.py +21 -2
  9. funboost/set_frame_config.py +2 -1
  10. funboost/utils/class_utils.py +101 -51
  11. funboost/utils/dependency_packages_in_pythonpath/__pycache__/__init__.cpython-39.pyc +0 -0
  12. funboost/utils/dependency_packages_in_pythonpath/__pycache__/add_to_pythonpath.cpython-39.pyc +0 -0
  13. funboost/utils/dependency_packages_in_pythonpath/aioredis/__init__.py +59 -59
  14. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/__init__.cpython-39.pyc +0 -0
  15. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/client.cpython-39.pyc +0 -0
  16. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/compat.cpython-39.pyc +0 -0
  17. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/connection.cpython-39.pyc +0 -0
  18. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/exceptions.cpython-39.pyc +0 -0
  19. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/lock.cpython-39.pyc +0 -0
  20. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/utils.cpython-39.pyc +0 -0
  21. funboost/utils/dependency_packages_in_pythonpath/aioredis/client.py +4804 -4804
  22. funboost/utils/dependency_packages_in_pythonpath/aioredis/compat.py +8 -8
  23. funboost/utils/dependency_packages_in_pythonpath/aioredis/connection.py +1668 -1668
  24. funboost/utils/dependency_packages_in_pythonpath/aioredis/exceptions.py +96 -96
  25. funboost/utils/dependency_packages_in_pythonpath/aioredis/lock.py +306 -306
  26. funboost/utils/dependency_packages_in_pythonpath/aioredis/log.py +15 -15
  27. funboost/utils/dependency_packages_in_pythonpath/aioredis/sentinel.py +329 -329
  28. funboost/utils/dependency_packages_in_pythonpath/aioredis/utils.py +61 -61
  29. funboost/utils/dependency_packages_in_pythonpath/func_timeout/StoppableThread.py +134 -133
  30. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__init__.py +16 -16
  31. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/StoppableThread.cpython-39.pyc +0 -0
  32. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/__init__.cpython-39.pyc +0 -0
  33. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/dafunc.cpython-39.pyc +0 -0
  34. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/exceptions.cpython-39.pyc +0 -0
  35. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/py3_raise.cpython-39.pyc +0 -0
  36. funboost/utils/dependency_packages_in_pythonpath/func_timeout/dafunc.py +244 -244
  37. funboost/utils/dependency_packages_in_pythonpath/func_timeout/dafunc2222.py +244 -0
  38. funboost/utils/dependency_packages_in_pythonpath/func_timeout/exceptions.py +98 -98
  39. funboost/utils/dependency_packages_in_pythonpath/func_timeout/py2_raise.py +7 -7
  40. funboost/utils/dependency_packages_in_pythonpath/func_timeout/py3_raise.py +7 -7
  41. funboost/utils/times/__init__.py +85 -85
  42. funboost/utils/times/version.py +1 -1
  43. {funboost-44.8.dist-info → funboost-45.0.dist-info}/METADATA +1 -2
  44. {funboost-44.8.dist-info → funboost-45.0.dist-info}/RECORD +48 -76
  45. {funboost-44.8.dist-info → funboost-45.0.dist-info}/entry_points.txt +0 -1
  46. funboost/function_result_web/__pycache__/app.cpython-37.pyc +0 -0
  47. funboost/function_result_web/__pycache__/functions.cpython-37.pyc +0 -0
  48. funboost/utils/dependency_packages_in_pythonpath/__pycache__/__init__.cpython-311.pyc +0 -0
  49. funboost/utils/dependency_packages_in_pythonpath/__pycache__/__init__.cpython-37.pyc +0 -0
  50. funboost/utils/dependency_packages_in_pythonpath/__pycache__/add_to_pythonpath.cpython-311.pyc +0 -0
  51. funboost/utils/dependency_packages_in_pythonpath/__pycache__/add_to_pythonpath.cpython-37.pyc +0 -0
  52. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/__init__.cpython-311.pyc +0 -0
  53. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/__init__.cpython-37.pyc +0 -0
  54. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/client.cpython-311.pyc +0 -0
  55. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/client.cpython-37.pyc +0 -0
  56. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/compat.cpython-311.pyc +0 -0
  57. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/compat.cpython-37.pyc +0 -0
  58. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/connection.cpython-311.pyc +0 -0
  59. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/connection.cpython-37.pyc +0 -0
  60. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/exceptions.cpython-311.pyc +0 -0
  61. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/exceptions.cpython-37.pyc +0 -0
  62. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/lock.cpython-311.pyc +0 -0
  63. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/lock.cpython-37.pyc +0 -0
  64. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/utils.cpython-311.pyc +0 -0
  65. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/utils.cpython-37.pyc +0 -0
  66. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/StoppableThread.cpython-311.pyc +0 -0
  67. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/StoppableThread.cpython-37.pyc +0 -0
  68. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/__init__.cpython-311.pyc +0 -0
  69. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/__init__.cpython-37.pyc +0 -0
  70. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/dafunc.cpython-311.pyc +0 -0
  71. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/dafunc.cpython-37.pyc +0 -0
  72. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/exceptions.cpython-311.pyc +0 -0
  73. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/exceptions.cpython-37.pyc +0 -0
  74. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/py3_raise.cpython-311.pyc +0 -0
  75. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/py3_raise.cpython-37.pyc +0 -0
  76. {funboost-44.8.dist-info → funboost-45.0.dist-info}/LICENSE +0 -0
  77. {funboost-44.8.dist-info → funboost-45.0.dist-info}/WHEEL +0 -0
  78. {funboost-44.8.dist-info → funboost-45.0.dist-info}/top_level.txt +0 -0
@@ -1,51 +1,101 @@
1
- #
2
- #
3
- # # def get_child_custom_attr(child_cls:type,):
4
- # # __dict = child_cls.__dict__
5
- #
6
- # def merge_cls(cls1:type,cls2:type):
7
- # class Cls(cls2):
8
- # pass
9
- # for k,v in cls1.__dict__.items():
10
- # if k.startswith('__') and k.endswith('__'):
11
- # continue
12
- # print(k,v)
13
- # setattr(Cls,k,v)
14
- # return Cls
15
- #
16
- #
17
- # if __name__ == '__main__':
18
- # class Parent:
19
- # attr1=1
20
- # def method_from_parent(self):
21
- # print('method_from_parent')
22
- #
23
- # def method_from_parent2(self):
24
- # print('method_from_parent2')
25
- #
26
- #
27
- # class Child(Parent):
28
- # attr1=2
29
- # attr2=22
30
- #
31
- # def method_from_parent2(self):
32
- # print('method_from_parent2chile')
33
- # def method_from_child(self:Parent):
34
- # print('method_from_child')
35
- #
36
- # class Child2(Parent,Parent):
37
- # attr1 = 3
38
- #
39
- # class Child2b(Child2):
40
- # attr1 = '2b'
41
- #
42
- #
43
- # class Child2New(Child2b,Child):
44
- # pass
45
- #
46
- #
47
- # print(Child2().method_from_parent2())
48
- # print(Child2New().method_from_parent2())
49
- #
50
- #
51
- #
1
+ import copy
2
+ import gc
3
+ import inspect
4
+ import re
5
+ import sys
6
+ import typing
7
+
8
+ import nb_log
9
+ from types import MethodType, FunctionType
10
+
11
+ from funboost.constant import FunctionKind
12
+
13
+
14
+ class ClsHelper:
15
+ @staticmethod
16
+ def get_instncae_method_cls(instncae_method):
17
+ print(instncae_method)
18
+ print(instncae_method.__qualname__)
19
+ print(instncae_method.__module__)
20
+ return getattr(sys.modules[instncae_method.__module__],instncae_method.__qualname__.split('.')[0])
21
+ # return instncae_method.__self__.__class__
22
+
23
+ @staticmethod
24
+ def get_classs_method_cls(class_method):
25
+ print(class_method)
26
+ print(class_method.__qualname__)
27
+ print(class_method.__module__)
28
+ return getattr(sys.modules[class_method.__module__],class_method.__qualname__.split('.')[0])
29
+
30
+ @staticmethod
31
+ def is_class_method(method):
32
+ # if inspect.ismethod(method):
33
+ # if hasattr(method, '__self__') and inspect.isclass(method.__self__):
34
+ # return True
35
+ # return False
36
+
37
+ sourcelines = inspect.getsourcelines(method)
38
+ # print(sourcelines)
39
+ line0: str = sourcelines[0][0]
40
+ if line0.replace(' ', '').startswith('@classmethod'):
41
+ return True
42
+
43
+ @staticmethod
44
+ def is_static_method(method):
45
+ sourcelines = inspect.getsourcelines(method)
46
+ line0: str = sourcelines[0][0]
47
+ if line0.replace(' ', '').startswith('@staticmethod'):
48
+ return True
49
+
50
+ @classmethod
51
+ def is_instance_method(cls, method):
52
+ if cls.is_class_method(method):
53
+ return False
54
+ if cls.is_static_method(method):
55
+ return False
56
+ if isinstance(method, FunctionType):
57
+ sourcelines = inspect.getsourcelines(method)
58
+ for line in sourcelines[0][:50]:
59
+ if not line.replace( ' ','').startswith('#'):
60
+ if not line.startswith('def') and re.search('\(\s*?self\s*?,',line):
61
+ return True
62
+ # method_class = getattr(method, '__qualname__', '').rsplit('.', 1)[0]
63
+ # if method_class: # 如果能找到类名,说明是类的成员
64
+ # print( f"{method.__name__} 属于类 {method_class} 的成员")
65
+ #
66
+ # return True
67
+
68
+ @classmethod
69
+ def is_common_function(cls, method):
70
+ if cls.is_static_method(method):
71
+ return False
72
+ if cls.is_class_method(method):
73
+ return False
74
+ if cls.is_instance_method(method):
75
+ return False
76
+ if isinstance(method, FunctionType):
77
+ sourcelines = inspect.getsourcelines(method)
78
+ for line in sourcelines[0][:50]:
79
+ if not line.replace(' ', '').startswith('#'):
80
+ if not re.search('\(\s*?self\s*?,', line):
81
+ return True
82
+
83
+ @classmethod
84
+ def get_method_kind(cls, method: typing.Callable) -> str:
85
+ if cls.is_class_method(method):
86
+ return FunctionKind.CLASS_METHOD
87
+ elif cls.is_static_method(method):
88
+ return FunctionKind.STATIC_METHOD
89
+ elif cls.is_instance_method(method):
90
+ return FunctionKind.INSTANCE_METHOD
91
+ elif cls.is_common_function(method):
92
+ return FunctionKind.COMMON_FUNCTION
93
+
94
+ @staticmethod
95
+ def get_obj_init_params_for_funboost(obj_init_params: dict):
96
+ obj_init_params.pop('self')
97
+ return copy.deepcopy(obj_init_params)
98
+
99
+
100
+ if __name__ == '__main__':
101
+ pass
@@ -1,59 +1,59 @@
1
- from aioredis.client import Redis, StrictRedis
2
- from aioredis.connection import (
3
- BlockingConnectionPool,
4
- Connection,
5
- ConnectionPool,
6
- SSLConnection,
7
- UnixDomainSocketConnection,
8
- )
9
- from aioredis.exceptions import (
10
- AuthenticationError,
11
- AuthenticationWrongNumberOfArgsError,
12
- BusyLoadingError,
13
- ChildDeadlockedError,
14
- ConnectionError,
15
- DataError,
16
- InvalidResponse,
17
- PubSubError,
18
- ReadOnlyError,
19
- RedisError,
20
- ResponseError,
21
- TimeoutError,
22
- WatchError,
23
- )
24
- from aioredis.utils import from_url
25
-
26
-
27
- def int_or_str(value):
28
- try:
29
- return int(value)
30
- except ValueError:
31
- return value
32
-
33
-
34
- __version__ = "2.0.1"
35
- VERSION = tuple(map(int_or_str, __version__.split(".")))
36
-
37
- __all__ = [
38
- "AuthenticationError",
39
- "AuthenticationWrongNumberOfArgsError",
40
- "BlockingConnectionPool",
41
- "BusyLoadingError",
42
- "ChildDeadlockedError",
43
- "Connection",
44
- "ConnectionError",
45
- "ConnectionPool",
46
- "DataError",
47
- "from_url",
48
- "InvalidResponse",
49
- "PubSubError",
50
- "ReadOnlyError",
51
- "Redis",
52
- "RedisError",
53
- "ResponseError",
54
- "SSLConnection",
55
- "StrictRedis",
56
- "TimeoutError",
57
- "UnixDomainSocketConnection",
58
- "WatchError",
59
- ]
1
+ from aioredis.client import Redis, StrictRedis
2
+ from aioredis.connection import (
3
+ BlockingConnectionPool,
4
+ Connection,
5
+ ConnectionPool,
6
+ SSLConnection,
7
+ UnixDomainSocketConnection,
8
+ )
9
+ from aioredis.exceptions import (
10
+ AuthenticationError,
11
+ AuthenticationWrongNumberOfArgsError,
12
+ BusyLoadingError,
13
+ ChildDeadlockedError,
14
+ ConnectionError,
15
+ DataError,
16
+ InvalidResponse,
17
+ PubSubError,
18
+ ReadOnlyError,
19
+ RedisError,
20
+ ResponseError,
21
+ TimeoutError,
22
+ WatchError,
23
+ )
24
+ from aioredis.utils import from_url
25
+
26
+
27
+ def int_or_str(value):
28
+ try:
29
+ return int(value)
30
+ except ValueError:
31
+ return value
32
+
33
+
34
+ __version__ = "2.0.1"
35
+ VERSION = tuple(map(int_or_str, __version__.split(".")))
36
+
37
+ __all__ = [
38
+ "AuthenticationError",
39
+ "AuthenticationWrongNumberOfArgsError",
40
+ "BlockingConnectionPool",
41
+ "BusyLoadingError",
42
+ "ChildDeadlockedError",
43
+ "Connection",
44
+ "ConnectionError",
45
+ "ConnectionPool",
46
+ "DataError",
47
+ "from_url",
48
+ "InvalidResponse",
49
+ "PubSubError",
50
+ "ReadOnlyError",
51
+ "Redis",
52
+ "RedisError",
53
+ "ResponseError",
54
+ "SSLConnection",
55
+ "StrictRedis",
56
+ "TimeoutError",
57
+ "UnixDomainSocketConnection",
58
+ "WatchError",
59
+ ]