funboost 49.7__py3-none-any.whl → 49.9__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 (36) hide show
  1. funboost/__init__.py +1 -1
  2. funboost/assist/celery_helper.py +1 -1
  3. funboost/concurrent_pool/async_pool_executor.py +23 -17
  4. funboost/constant.py +23 -0
  5. funboost/consumers/base_consumer.py +15 -8
  6. funboost/consumers/grpc_consumer.py +102 -0
  7. funboost/consumers/kafka_consumer.py +4 -2
  8. funboost/consumers/kafka_consumer_manually_commit.py +7 -2
  9. funboost/consumers/mysql_cdc_consumer.py +95 -0
  10. funboost/contrib/cdc/__init__.py +0 -0
  11. funboost/contrib/cdc/mysql2mysql.py +44 -0
  12. funboost/core/booster.py +25 -2
  13. funboost/core/exceptions.py +3 -0
  14. funboost/core/func_params_model.py +7 -4
  15. funboost/core/msg_result_getter.py +8 -7
  16. funboost/factories/broker_kind__publsiher_consumer_type_map.py +10 -1
  17. funboost/publishers/base_publisher.py +5 -6
  18. funboost/publishers/grpc_publisher.py +53 -0
  19. funboost/publishers/kafka_publisher.py +3 -1
  20. funboost/publishers/mysql_cdc_publisher.py +24 -0
  21. funboost/timing_job/timing_push.py +3 -1
  22. {funboost-49.7.dist-info → funboost-49.9.dist-info}/METADATA +69 -33
  23. {funboost-49.7.dist-info → funboost-49.9.dist-info}/RECORD +27 -30
  24. funboost/utils/class_utils2.py +0 -94
  25. funboost/utils/custom_pysnooper.py +0 -149
  26. funboost/utils/pysnooper_ydf/__init__.py +0 -32
  27. funboost/utils/pysnooper_ydf/pycompat.py +0 -82
  28. funboost/utils/pysnooper_ydf/tracer.py +0 -479
  29. funboost/utils/pysnooper_ydf/utils.py +0 -101
  30. funboost/utils/pysnooper_ydf/variables.py +0 -133
  31. funboost/utils/times/__init__.py +0 -85
  32. funboost/utils/times/version.py +0 -1
  33. {funboost-49.7.dist-info → funboost-49.9.dist-info}/LICENSE +0 -0
  34. {funboost-49.7.dist-info → funboost-49.9.dist-info}/WHEEL +0 -0
  35. {funboost-49.7.dist-info → funboost-49.9.dist-info}/entry_points.txt +0 -0
  36. {funboost-49.7.dist-info → funboost-49.9.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)
@@ -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
@@ -1 +0,0 @@
1
- VERSION = '0.7'