(func, before, after, *args, **kwargs)
| 6 | |
| 7 | |
| 8 | def overlap_chunk(func, before, after, *args, **kwargs): |
| 9 | dfs = [df for df in args if isinstance(df, CombinedOutput)] |
| 10 | combined, prev_part_length, next_part_length = dfs[0] |
| 11 | |
| 12 | args = [arg[0] if isinstance(arg, CombinedOutput) else arg for arg in args] |
| 13 | |
| 14 | out = func(*args, **kwargs) |
| 15 | |
| 16 | if prev_part_length is None: |
| 17 | before = None |
| 18 | if isinstance(before, datetime.timedelta): |
| 19 | before = prev_part_length |
| 20 | |
| 21 | expansion = None |
| 22 | if combined.shape[0] != 0: |
| 23 | expansion = out.shape[0] // combined.shape[0] |
| 24 | if before and expansion: |
| 25 | before *= expansion |
| 26 | if next_part_length is None: |
| 27 | return out.iloc[before:] |
| 28 | if isinstance(after, datetime.timedelta): |
| 29 | after = next_part_length |
| 30 | if after and expansion: |
| 31 | after *= expansion |
| 32 | return out.iloc[before:-after] |
| 33 | |
| 34 | |
| 35 | def _head_timedelta(current, next_, after): |
no test coverage detected