|
11 | 11 |
|
12 | 12 | LOGGER = get_logger() |
13 | 13 |
|
| 14 | +# NB: We've observed that Trello will only return 50 actions, this is to sub-paginate |
| 15 | +MAX_API_RESPONSE_SIZE = 50 |
| 16 | + |
14 | 17 |
|
15 | 18 | class OrderChecker: |
16 | 19 | """ Class with context manager to check ordering of values. """ |
@@ -56,25 +59,14 @@ def __exit__(self, *args): |
56 | 59 | """ Required for context manager usage. """ |
57 | 60 |
|
58 | 61 |
|
59 | | -class Mixin: |
60 | | - """ Empty class to mark mixin classes as such. """ |
61 | | - |
62 | | - |
63 | | -class Unsortable(Mixin): |
| 62 | +class Unsortable: |
64 | 63 | """ |
65 | | - Mixin class to mark a Stream subclass as Unsortable |
| 64 | + Marker class to identify Stream subclasses that are unsortable. |
66 | 65 | NB: No current functionality, but we thought it was useful for higher-order declarative behavior. |
67 | | - e.g.: |
68 | | - class MyStream(Unsortable, Stream): |
69 | | - # Specify properties, implement unique things |
70 | 66 | """ |
71 | 67 |
|
72 | 68 |
|
73 | | -# NB: We've observed that Trello will only return 50 actions, this is to sub-paginate |
74 | | -MAX_API_RESPONSE_SIZE = 50 |
75 | | - |
76 | | - |
77 | | -class DateWindowPaginated(Mixin): |
| 69 | +class DateWindowPaginated: |
78 | 70 | """ |
79 | 71 | Mixin class to provide date windowing on the `get_records` requests |
80 | 72 | """ |
@@ -241,48 +233,6 @@ def sync(self): |
241 | 233 | yield rec |
242 | 234 |
|
243 | 235 |
|
244 | | -class AddCustomFields(Mixin): |
245 | | - def _get_dropdown_option_key(self, field_id, option_id): |
246 | | - return field_id + '_' + option_id |
247 | | - |
248 | | - def build_custom_fields_maps(self, **kwargs): |
249 | | - custom_fields_map = {} |
250 | | - dropdown_options_map = {} |
251 | | - board_id_list = kwargs['parent_id_list'] |
252 | | - # The custom fields are defined on the board level, so this function is called on a per-board basis |
253 | | - # Therefore, we assert that only one board is being passed in |
254 | | - assert len(board_id_list) == 1 |
255 | | - custom_fields = self.client.get('/boards/{}/customFields'.format(board_id_list[0])) # pylint: disable=no-member |
256 | | - for custom_field in custom_fields: |
257 | | - custom_fields_map[custom_field['id']] = custom_field['name'] |
258 | | - if custom_field['type'] == 'list': |
259 | | - for dropdown_option in custom_field['options']: |
260 | | - dropdown_option_key = self._get_dropdown_option_key(dropdown_option['idCustomField'], dropdown_option['id']) |
261 | | - dropdown_options_map[dropdown_option_key] = dropdown_option['value']['text'] |
262 | | - |
263 | | - return custom_fields_map, dropdown_options_map |
264 | | - |
265 | | - |
266 | | - def modify_record(self, record, **kwargs): |
267 | | - custom_fields_map = kwargs['custom_fields_map'] |
268 | | - dropdown_options_map = kwargs['dropdown_options_map'] |
269 | | - for custom_field in record['customFieldItems']: |
270 | | - custom_field['name'] = custom_fields_map[custom_field['idCustomField']] |
271 | | - if custom_field.get('idValue', None): |
272 | | - dropdown_option_key = self._get_dropdown_option_key(custom_field['idCustomField'], custom_field['idValue']) |
273 | | - custom_field['value'] = {'option': dropdown_options_map[dropdown_option_key]} |
274 | | - |
275 | | - return record |
276 | | - |
277 | | - |
278 | | -class AddBoardId(Mixin): |
279 | | - def modify_record(self, record, **kwargs): |
280 | | - board_id_list = kwargs['parent_id_list'] |
281 | | - assert len(board_id_list) == 1 |
282 | | - record["boardId"] = board_id_list[0] |
283 | | - return record |
284 | | - |
285 | | - |
286 | 236 | class LegacyChildStream(LegacyStream): |
287 | 237 | """ |
288 | 238 | Legacy base class for child streams (pre-refactor). |
|
0 commit comments