funboost 49.8__py3-none-any.whl → 50.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.
- funboost/__init__.py +1 -1
- funboost/assist/celery_helper.py +1 -1
- funboost/concurrent_pool/async_pool_executor.py +7 -2
- funboost/constant.py +23 -0
- funboost/consumers/base_consumer.py +12 -7
- funboost/consumers/grpc_consumer.py +102 -0
- funboost/consumers/kafka_consumer.py +4 -2
- funboost/consumers/kafka_consumer_manually_commit.py +7 -2
- funboost/consumers/mysql_cdc_consumer.py +95 -0
- funboost/contrib/cdc/__init__.py +0 -0
- funboost/contrib/cdc/mysql2mysql.py +44 -0
- funboost/core/booster.py +25 -2
- funboost/core/exceptions.py +3 -0
- funboost/core/func_params_model.py +6 -5
- funboost/core/msg_result_getter.py +8 -7
- funboost/factories/broker_kind__publsiher_consumer_type_map.py +10 -1
- funboost/publishers/base_publisher.py +5 -6
- funboost/publishers/grpc_publisher.py +53 -0
- funboost/publishers/kafka_publisher.py +3 -1
- funboost/publishers/mysql_cdc_publisher.py +24 -0
- funboost/timing_job/timing_push.py +3 -1
- {funboost-49.8.dist-info → funboost-50.0.dist-info}/METADATA +69 -33
- {funboost-49.8.dist-info → funboost-50.0.dist-info}/RECORD +27 -30
- funboost/utils/class_utils2.py +0 -94
- funboost/utils/custom_pysnooper.py +0 -149
- funboost/utils/pysnooper_ydf/__init__.py +0 -32
- funboost/utils/pysnooper_ydf/pycompat.py +0 -82
- funboost/utils/pysnooper_ydf/tracer.py +0 -479
- funboost/utils/pysnooper_ydf/utils.py +0 -101
- funboost/utils/pysnooper_ydf/variables.py +0 -133
- funboost/utils/times/__init__.py +0 -85
- funboost/utils/times/version.py +0 -1
- {funboost-49.8.dist-info → funboost-50.0.dist-info}/LICENSE +0 -0
- {funboost-49.8.dist-info → funboost-50.0.dist-info}/WHEEL +0 -0
- {funboost-49.8.dist-info → funboost-50.0.dist-info}/entry_points.txt +0 -0
- {funboost-49.8.dist-info → funboost-50.0.dist-info}/top_level.txt +0 -0
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import itertools
|
|
2
|
-
import abc
|
|
3
|
-
try:
|
|
4
|
-
from collections.abc import Mapping, Sequence
|
|
5
|
-
except ImportError:
|
|
6
|
-
from collections import Mapping, Sequence
|
|
7
|
-
from copy import deepcopy
|
|
8
|
-
|
|
9
|
-
from . import utils
|
|
10
|
-
from . import pycompat
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def needs_parentheses(source):
|
|
14
|
-
def code(s):
|
|
15
|
-
return compile(s, '<variable>', 'eval').co_code
|
|
16
|
-
|
|
17
|
-
return code('{}.x'.format(source)) != code('({}).x'.format(source))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class BaseVariable(pycompat.ABC):
|
|
21
|
-
def __init__(self, source, exclude=()):
|
|
22
|
-
self.source = source
|
|
23
|
-
self.exclude = utils.ensure_tuple(exclude)
|
|
24
|
-
self.code = compile(source, '<variable>', 'eval')
|
|
25
|
-
if needs_parentheses(source):
|
|
26
|
-
self.unambiguous_source = '({})'.format(source)
|
|
27
|
-
else:
|
|
28
|
-
self.unambiguous_source = source
|
|
29
|
-
|
|
30
|
-
def items(self, frame):
|
|
31
|
-
try:
|
|
32
|
-
main_value = eval(self.code, frame.f_globals or {}, frame.f_locals)
|
|
33
|
-
except BaseException :
|
|
34
|
-
return ()
|
|
35
|
-
return self._items(main_value)
|
|
36
|
-
|
|
37
|
-
@abc.abstractmethod
|
|
38
|
-
def _items(self, key):
|
|
39
|
-
raise NotImplementedError
|
|
40
|
-
|
|
41
|
-
@property
|
|
42
|
-
def _fingerprint(self):
|
|
43
|
-
return (type(self), self.source, self.exclude)
|
|
44
|
-
|
|
45
|
-
def __hash__(self):
|
|
46
|
-
return hash(self._fingerprint)
|
|
47
|
-
|
|
48
|
-
def __eq__(self, other):
|
|
49
|
-
return (isinstance(other, BaseVariable) and
|
|
50
|
-
self._fingerprint == other._fingerprint)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class CommonVariable(BaseVariable):
|
|
54
|
-
def _items(self, main_value):
|
|
55
|
-
result = [(self.source, utils.get_shortish_repr(main_value))]
|
|
56
|
-
for key in self._safe_keys(main_value):
|
|
57
|
-
try:
|
|
58
|
-
if key in self.exclude:
|
|
59
|
-
continue
|
|
60
|
-
value = self._get_value(main_value, key)
|
|
61
|
-
except BaseException :
|
|
62
|
-
continue
|
|
63
|
-
result.append((
|
|
64
|
-
'{}{}'.format(self.unambiguous_source, self._format_key(key)),
|
|
65
|
-
utils.get_shortish_repr(value)
|
|
66
|
-
))
|
|
67
|
-
return result
|
|
68
|
-
|
|
69
|
-
def _safe_keys(self, main_value):
|
|
70
|
-
try:
|
|
71
|
-
for key in self._keys(main_value):
|
|
72
|
-
yield key
|
|
73
|
-
except BaseException :
|
|
74
|
-
pass
|
|
75
|
-
|
|
76
|
-
def _keys(self, main_value):
|
|
77
|
-
return ()
|
|
78
|
-
|
|
79
|
-
def _format_key(self, key):
|
|
80
|
-
raise NotImplementedError
|
|
81
|
-
|
|
82
|
-
def _get_value(self, main_value, key):
|
|
83
|
-
raise NotImplementedError
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class Attrs(CommonVariable):
|
|
87
|
-
def _keys(self, main_value):
|
|
88
|
-
return itertools.chain(
|
|
89
|
-
getattr(main_value, '__dict__', ()),
|
|
90
|
-
getattr(main_value, '__slots__', ())
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
def _format_key(self, key):
|
|
94
|
-
return '.' + key
|
|
95
|
-
|
|
96
|
-
def _get_value(self, main_value, key):
|
|
97
|
-
return getattr(main_value, key)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class Keys(CommonVariable):
|
|
101
|
-
def _keys(self, main_value):
|
|
102
|
-
return main_value.keys()
|
|
103
|
-
|
|
104
|
-
def _format_key(self, key):
|
|
105
|
-
return '[{}]'.format(utils.get_shortish_repr(key))
|
|
106
|
-
|
|
107
|
-
def _get_value(self, main_value, key):
|
|
108
|
-
return main_value[key]
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class Indices(Keys):
|
|
112
|
-
_slice = slice(None)
|
|
113
|
-
|
|
114
|
-
def _keys(self, main_value):
|
|
115
|
-
return range(len(main_value))[self._slice]
|
|
116
|
-
|
|
117
|
-
def __getitem__(self, item):
|
|
118
|
-
assert isinstance(item, slice)
|
|
119
|
-
result = deepcopy(self)
|
|
120
|
-
result._slice = item
|
|
121
|
-
return result
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
class Exploding(BaseVariable):
|
|
125
|
-
def _items(self, main_value):
|
|
126
|
-
if isinstance(main_value, Mapping):
|
|
127
|
-
cls = Keys
|
|
128
|
-
elif isinstance(main_value, Sequence):
|
|
129
|
-
cls = Indices
|
|
130
|
-
else:
|
|
131
|
-
cls = Attrs
|
|
132
|
-
|
|
133
|
-
return cls(self.source, self.exclude)._items(main_value)
|
funboost/utils/times/__init__.py
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import datetime
|
|
2
|
-
import sys
|
|
3
|
-
|
|
4
|
-
import arrow
|
|
5
|
-
|
|
6
|
-
from .version import VERSION
|
|
7
|
-
|
|
8
|
-
PY3 = sys.version_info[0] == 3
|
|
9
|
-
if PY3:
|
|
10
|
-
string_types = str
|
|
11
|
-
else:
|
|
12
|
-
string_types = basestring
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
__author__ = 'Vincent Driessen <vincent@3rdcloud.com>'
|
|
16
|
-
__version__ = VERSION
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def to_universal(local_dt, timezone=None):
|
|
20
|
-
"""
|
|
21
|
-
Converts the given local datetime or UNIX timestamp to a universal
|
|
22
|
-
datetime.
|
|
23
|
-
"""
|
|
24
|
-
if isinstance(local_dt, (int, float)):
|
|
25
|
-
if timezone is not None:
|
|
26
|
-
raise ValueError('Timezone argument illegal when using UNIX timestamps.')
|
|
27
|
-
return from_unix(local_dt)
|
|
28
|
-
elif isinstance(local_dt, string_types):
|
|
29
|
-
local_dt = arrow.get(local_dt).to('UTC').naive
|
|
30
|
-
|
|
31
|
-
return from_local(local_dt, timezone)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def from_local(local_dt, timezone=None):
|
|
35
|
-
"""Converts the given local datetime to a universal datetime."""
|
|
36
|
-
if not isinstance(local_dt, datetime.datetime):
|
|
37
|
-
raise TypeError('Expected a datetime object')
|
|
38
|
-
|
|
39
|
-
if timezone is None:
|
|
40
|
-
a = arrow.get(local_dt)
|
|
41
|
-
else:
|
|
42
|
-
a = arrow.get(local_dt, timezone)
|
|
43
|
-
return a.to('UTC').naive
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def from_unix(ut):
|
|
47
|
-
"""
|
|
48
|
-
Converts a UNIX timestamp, as returned by `time.time()`, to universal
|
|
49
|
-
time. Assumes the input is in UTC, as `time.time()` does.
|
|
50
|
-
"""
|
|
51
|
-
if not isinstance(ut, (int, float)):
|
|
52
|
-
raise TypeError('Expected an int or float value')
|
|
53
|
-
|
|
54
|
-
return arrow.get(ut).naive
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def to_local(dt, timezone):
|
|
58
|
-
"""Converts universal datetime to a local representation in given timezone."""
|
|
59
|
-
if dt.tzinfo is not None:
|
|
60
|
-
raise ValueError(
|
|
61
|
-
'First argument to to_local() should be a universal time.'
|
|
62
|
-
)
|
|
63
|
-
if not isinstance(timezone, string_types):
|
|
64
|
-
raise TypeError('expected a timezone name (string), but got {} instead'.format(type(timezone)))
|
|
65
|
-
return arrow.get(dt).to(timezone).datetime
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def to_unix(dt):
|
|
69
|
-
"""Converts a datetime object to unixtime"""
|
|
70
|
-
if not isinstance(dt, datetime.datetime):
|
|
71
|
-
raise TypeError('Expected a datetime object')
|
|
72
|
-
|
|
73
|
-
return arrow.get(dt).timestamp
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def format(dt, timezone, fmt=None):
|
|
77
|
-
"""Formats the given universal time for display in the given time zone."""
|
|
78
|
-
local = to_local(dt, timezone)
|
|
79
|
-
if fmt is None:
|
|
80
|
-
return local.isoformat()
|
|
81
|
-
else:
|
|
82
|
-
return local.strftime(fmt)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
now = datetime.datetime.utcnow
|
funboost/utils/times/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = '0.7'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|