meerschaum 2.0.0rc7__py3-none-any.whl → 2.0.0rc9__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.
- meerschaum/actions/__init__.py +97 -48
- meerschaum/actions/bootstrap.py +1 -1
- meerschaum/actions/clear.py +1 -1
- meerschaum/actions/deduplicate.py +1 -1
- meerschaum/actions/delete.py +8 -7
- meerschaum/actions/drop.py +1 -10
- meerschaum/actions/edit.py +1 -1
- meerschaum/actions/install.py +1 -1
- meerschaum/actions/pause.py +1 -1
- meerschaum/actions/register.py +1 -1
- meerschaum/actions/setup.py +1 -1
- meerschaum/actions/show.py +1 -1
- meerschaum/actions/start.py +18 -7
- meerschaum/actions/stop.py +5 -4
- meerschaum/actions/sync.py +3 -1
- meerschaum/actions/uninstall.py +1 -1
- meerschaum/actions/upgrade.py +1 -1
- meerschaum/actions/verify.py +54 -3
- meerschaum/config/_default.py +1 -1
- meerschaum/config/_formatting.py +26 -0
- meerschaum/config/_jobs.py +28 -5
- meerschaum/config/_paths.py +21 -5
- meerschaum/config/_version.py +1 -1
- meerschaum/connectors/api/_fetch.py +40 -38
- meerschaum/connectors/api/_pipes.py +10 -17
- meerschaum/connectors/sql/_fetch.py +29 -11
- meerschaum/connectors/sql/_pipes.py +1 -2
- meerschaum/core/Pipe/__init__.py +31 -10
- meerschaum/core/Pipe/_data.py +23 -13
- meerschaum/core/Pipe/_deduplicate.py +44 -23
- meerschaum/core/Pipe/_dtypes.py +2 -1
- meerschaum/core/Pipe/_fetch.py +29 -0
- meerschaum/core/Pipe/_sync.py +25 -18
- meerschaum/core/Pipe/_verify.py +60 -25
- meerschaum/plugins/__init__.py +3 -0
- meerschaum/utils/daemon/Daemon.py +108 -27
- meerschaum/utils/daemon/__init__.py +35 -1
- meerschaum/utils/dataframe.py +2 -0
- meerschaum/utils/formatting/__init__.py +144 -1
- meerschaum/utils/formatting/_pipes.py +28 -5
- meerschaum/utils/misc.py +184 -188
- meerschaum/utils/packages/__init__.py +1 -1
- meerschaum/utils/packages/_packages.py +1 -0
- {meerschaum-2.0.0rc7.dist-info → meerschaum-2.0.0rc9.dist-info}/METADATA +4 -1
- {meerschaum-2.0.0rc7.dist-info → meerschaum-2.0.0rc9.dist-info}/RECORD +51 -51
- {meerschaum-2.0.0rc7.dist-info → meerschaum-2.0.0rc9.dist-info}/LICENSE +0 -0
- {meerschaum-2.0.0rc7.dist-info → meerschaum-2.0.0rc9.dist-info}/NOTICE +0 -0
- {meerschaum-2.0.0rc7.dist-info → meerschaum-2.0.0rc9.dist-info}/WHEEL +0 -0
- {meerschaum-2.0.0rc7.dist-info → meerschaum-2.0.0rc9.dist-info}/entry_points.txt +0 -0
- {meerschaum-2.0.0rc7.dist-info → meerschaum-2.0.0rc9.dist-info}/top_level.txt +0 -0
- {meerschaum-2.0.0rc7.dist-info → meerschaum-2.0.0rc9.dist-info}/zip-safe +0 -0
@@ -33,6 +33,7 @@ __all__ = sorted([
|
|
33
33
|
'translate_rich_to_termcolor',
|
34
34
|
'get_console',
|
35
35
|
'print_tuple',
|
36
|
+
'print_options',
|
36
37
|
'fill_ansi',
|
37
38
|
'pprint',
|
38
39
|
'highlight_pipes',
|
@@ -222,9 +223,29 @@ def print_tuple(
|
|
222
223
|
common_only: bool = False,
|
223
224
|
upper_padding: int = 0,
|
224
225
|
lower_padding: int = 0,
|
226
|
+
calm: bool = False,
|
225
227
|
_progress: Optional['rich.progress.Progress'] = None,
|
226
228
|
) -> None:
|
227
|
-
"""
|
229
|
+
"""
|
230
|
+
Print `meerschaum.utils.typing.SuccessTuple`.
|
231
|
+
|
232
|
+
Parameters
|
233
|
+
----------
|
234
|
+
skip_common: bool, default True
|
235
|
+
If `True`, do not print common success tuples (i.e. `(True, "Success")`).
|
236
|
+
|
237
|
+
common_only: bool, default False
|
238
|
+
If `True`, only print if the success tuple is common.
|
239
|
+
|
240
|
+
upper_padding: int, default 0
|
241
|
+
How many newlines to prepend to the message.
|
242
|
+
|
243
|
+
lower_padding: int, default 0
|
244
|
+
How many newlines to append to the message.
|
245
|
+
|
246
|
+
calm: bool, default False
|
247
|
+
If `True`, use the default emoji and color scheme.
|
248
|
+
"""
|
228
249
|
from meerschaum.config.static import STATIC_CONFIG
|
229
250
|
_init()
|
230
251
|
try:
|
@@ -233,6 +254,9 @@ def print_tuple(
|
|
233
254
|
status = 'failure'
|
234
255
|
tup = None, None
|
235
256
|
|
257
|
+
if calm:
|
258
|
+
status += '_calm'
|
259
|
+
|
236
260
|
omit_messages = STATIC_CONFIG['system']['success']['ignore']
|
237
261
|
|
238
262
|
do_print = True
|
@@ -262,6 +286,125 @@ def print_tuple(
|
|
262
286
|
print(msg)
|
263
287
|
|
264
288
|
|
289
|
+
def print_options(
|
290
|
+
options: Optional[Dict[str, Any]] = None,
|
291
|
+
nopretty: bool = False,
|
292
|
+
no_rich: bool = False,
|
293
|
+
name: str = 'options',
|
294
|
+
header: Optional[str] = None,
|
295
|
+
num_cols: Optional[int] = None,
|
296
|
+
adjust_cols: bool = True,
|
297
|
+
**kw
|
298
|
+
) -> None:
|
299
|
+
"""
|
300
|
+
Print items in an iterable as a fancy table.
|
301
|
+
|
302
|
+
Parameters
|
303
|
+
----------
|
304
|
+
options: Optional[Dict[str, Any]], default None
|
305
|
+
The iterable to be printed.
|
306
|
+
|
307
|
+
nopretty: bool, default False
|
308
|
+
If `True`, don't use fancy formatting.
|
309
|
+
|
310
|
+
no_rich: bool, default False
|
311
|
+
If `True`, don't use `rich` to format the output.
|
312
|
+
|
313
|
+
name: str, default 'options'
|
314
|
+
The text in the default header after `'Available'`.
|
315
|
+
|
316
|
+
header: Optional[str], default None
|
317
|
+
If provided, override `name` and use this as the header text.
|
318
|
+
|
319
|
+
num_cols: Optional[int], default None
|
320
|
+
How many columns in the table. Depends on the terminal size. If `None`, use 8.
|
321
|
+
|
322
|
+
adjust_cols: bool, default True
|
323
|
+
If `True`, adjust the number of columns depending on the terminal size.
|
324
|
+
|
325
|
+
"""
|
326
|
+
import os
|
327
|
+
from meerschaum.utils.packages import import_rich
|
328
|
+
from meerschaum.utils.formatting import make_header, highlight_pipes
|
329
|
+
from meerschaum.actions import actions as _actions
|
330
|
+
from meerschaum.utils.misc import get_cols_lines, string_width, iterate_chunks
|
331
|
+
|
332
|
+
|
333
|
+
if options is None:
|
334
|
+
options = {}
|
335
|
+
_options = []
|
336
|
+
for o in options:
|
337
|
+
_options.append(str(o))
|
338
|
+
_header = f"Available {name}" if header is None else header
|
339
|
+
|
340
|
+
if num_cols is None:
|
341
|
+
num_cols = 8
|
342
|
+
|
343
|
+
def _print_options_no_rich():
|
344
|
+
if not nopretty:
|
345
|
+
print()
|
346
|
+
print(make_header(_header))
|
347
|
+
### print actions
|
348
|
+
for option in sorted(_options):
|
349
|
+
if not nopretty:
|
350
|
+
print(" - ", end="")
|
351
|
+
print(option)
|
352
|
+
if not nopretty:
|
353
|
+
print()
|
354
|
+
|
355
|
+
rich = import_rich()
|
356
|
+
if rich is None or nopretty or no_rich:
|
357
|
+
_print_options_no_rich()
|
358
|
+
return None
|
359
|
+
|
360
|
+
### Prevent too many options from being truncated on small terminals.
|
361
|
+
if adjust_cols and _options:
|
362
|
+
_cols, _lines = get_cols_lines()
|
363
|
+
while num_cols > 1:
|
364
|
+
cell_len = int(((_cols - 4) - (3 * (num_cols - 1))) / num_cols)
|
365
|
+
num_too_big = sum([(1 if string_width(o) > cell_len else 0) for o in _options])
|
366
|
+
if num_too_big > int(len(_options) / 3):
|
367
|
+
num_cols -= 1
|
368
|
+
continue
|
369
|
+
break
|
370
|
+
|
371
|
+
from meerschaum.utils.formatting import pprint, get_console
|
372
|
+
from meerschaum.utils.packages import attempt_import
|
373
|
+
rich_columns = attempt_import('rich.columns')
|
374
|
+
rich_panel = attempt_import('rich.panel')
|
375
|
+
rich_table = attempt_import('rich.table')
|
376
|
+
Text = attempt_import('rich.text').Text
|
377
|
+
box = attempt_import('rich.box')
|
378
|
+
Panel = rich_panel.Panel
|
379
|
+
Columns = rich_columns.Columns
|
380
|
+
Table = rich_table.Table
|
381
|
+
|
382
|
+
if _header is not None:
|
383
|
+
table = Table(
|
384
|
+
title = '\n' + _header,
|
385
|
+
box = box.SIMPLE,
|
386
|
+
show_header = False,
|
387
|
+
show_footer = False,
|
388
|
+
title_style = '',
|
389
|
+
expand = True,
|
390
|
+
)
|
391
|
+
else:
|
392
|
+
table = Table.grid(padding=(0, 2))
|
393
|
+
for i in range(num_cols):
|
394
|
+
table.add_column()
|
395
|
+
|
396
|
+
chunks = iterate_chunks(
|
397
|
+
[Text.from_ansi(highlight_pipes(o)) for o in sorted(_options)],
|
398
|
+
num_cols,
|
399
|
+
fillvalue=''
|
400
|
+
)
|
401
|
+
for c in chunks:
|
402
|
+
table.add_row(*c)
|
403
|
+
|
404
|
+
get_console().print(table)
|
405
|
+
return None
|
406
|
+
|
407
|
+
|
265
408
|
def fill_ansi(string: str, style: str = '') -> str:
|
266
409
|
"""
|
267
410
|
Fill in non-formatted segments of ANSI text.
|
@@ -309,19 +309,42 @@ def highlight_pipes(message: str) -> str:
|
|
309
309
|
"""
|
310
310
|
Add syntax highlighting to an info message containing stringified `meerschaum.Pipe` objects.
|
311
311
|
"""
|
312
|
-
if 'Pipe(' not in message
|
312
|
+
if 'Pipe(' not in message and ')' not in message:
|
313
313
|
return message
|
314
|
+
|
314
315
|
from meerschaum import Pipe
|
315
316
|
segments = message.split('Pipe(')
|
316
317
|
msg = ''
|
317
318
|
_d = {}
|
318
319
|
for i, segment in enumerate(segments):
|
319
|
-
|
320
|
-
|
321
|
-
|
320
|
+
comma_index = segment.find(',')
|
321
|
+
paren_index = segment.find(')')
|
322
|
+
single_quote_index = segment.find("'")
|
323
|
+
double_quote_index = segment.find('"')
|
324
|
+
|
325
|
+
has_comma = comma_index != -1
|
326
|
+
has_paren = paren_index != -1
|
327
|
+
has_single_quote = single_quote_index != -1
|
328
|
+
has_double_quote = double_quote_index != -1
|
329
|
+
quote_index = double_quote_index if has_double_quote else single_quote_index
|
330
|
+
|
331
|
+
has_pipe = (
|
332
|
+
has_comma
|
333
|
+
and
|
334
|
+
has_paren
|
335
|
+
and
|
336
|
+
(has_single_quote or has_double_quote)
|
337
|
+
and not
|
338
|
+
(has_double_quote and has_double_quote)
|
339
|
+
and not
|
340
|
+
(comma_index > paren_index or quote_index > paren_index)
|
341
|
+
)
|
342
|
+
|
343
|
+
if has_pipe:
|
344
|
+
code = "_d['pipe'] = Pipe(" + segment[:paren_index + 1]
|
322
345
|
try:
|
323
346
|
exec(code)
|
324
|
-
_to_add = pipe_repr(_d['pipe']) + segment[paren_index:]
|
347
|
+
_to_add = pipe_repr(_d['pipe']) + segment[paren_index + 1:]
|
325
348
|
except Exception as e:
|
326
349
|
_to_add = 'Pipe(' + segment
|
327
350
|
msg += _to_add
|
meerschaum/utils/misc.py
CHANGED
@@ -6,25 +6,39 @@ Miscellaneous functions go here
|
|
6
6
|
"""
|
7
7
|
|
8
8
|
from __future__ import annotations
|
9
|
+
from datetime import timedelta
|
9
10
|
from meerschaum.utils.typing import (
|
10
|
-
Union,
|
11
|
-
|
11
|
+
Union,
|
12
|
+
Any,
|
13
|
+
Callable,
|
14
|
+
Optional,
|
15
|
+
List,
|
16
|
+
Dict,
|
17
|
+
SuccessTuple,
|
18
|
+
Iterable,
|
19
|
+
PipesDict,
|
20
|
+
Tuple,
|
21
|
+
InstanceConnector,
|
22
|
+
Hashable,
|
23
|
+
Generator,
|
24
|
+
Iterator,
|
12
25
|
)
|
13
26
|
import meerschaum as mrsm
|
14
27
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
__pdoc__: Dict[str, bool] = {
|
29
|
+
'to_pandas_dtype': False,
|
30
|
+
'filter_unseen_df': False,
|
31
|
+
'add_missing_cols_to_df': False,
|
32
|
+
'parse_df_datetimes': False,
|
33
|
+
'df_from_literal': False,
|
34
|
+
'get_json_cols': False,
|
35
|
+
'get_unhashable_cols': False,
|
36
|
+
'enforce_dtypes': False,
|
37
|
+
'get_datetime_bound_from_df': False,
|
38
|
+
'df_is_chunk_generator': False,
|
39
|
+
'choices_docstring': False,
|
40
|
+
'_get_subaction_names': False,
|
41
|
+
}
|
28
42
|
|
29
43
|
|
30
44
|
def add_method_to_class(
|
@@ -270,178 +284,6 @@ def is_pipe_registered(
|
|
270
284
|
return ck in pipes and mk in pipes[ck] and lk in pipes[ck][mk]
|
271
285
|
|
272
286
|
|
273
|
-
def _get_subaction_names(action : str, globs : dict = None) -> List[str]:
|
274
|
-
"""NOTE: Don't use this function. You should use `meerschaum.actions.get_subactions()` instead.
|
275
|
-
This only exists for internal use.
|
276
|
-
"""
|
277
|
-
if globs is None:
|
278
|
-
import importlib
|
279
|
-
module = importlib.import_module(f'meerschaum.actions.{action}')
|
280
|
-
globs = vars(module)
|
281
|
-
subactions = []
|
282
|
-
for item in globs:
|
283
|
-
if f'_{action}' in item and 'complete' not in item.lstrip('_'):
|
284
|
-
subactions.append(globs[item])
|
285
|
-
return subactions
|
286
|
-
|
287
|
-
|
288
|
-
def choices_docstring(action: str, globs : Optional[Dict[str, Any]] = None) -> str:
|
289
|
-
"""
|
290
|
-
Append the an action's available options to the module docstring.
|
291
|
-
This function is to be placed at the bottom of each action module.
|
292
|
-
|
293
|
-
Parameters
|
294
|
-
----------
|
295
|
-
action: str
|
296
|
-
The name of the action module (e.g. 'install').
|
297
|
-
|
298
|
-
globs: Optional[Dict[str, Any]], default None
|
299
|
-
An optional dictionary of global variables.
|
300
|
-
|
301
|
-
Returns
|
302
|
-
-------
|
303
|
-
The generated docstring for the module.
|
304
|
-
|
305
|
-
Examples
|
306
|
-
--------
|
307
|
-
>>> from meerschaum.utils.misc import choices_docstring as _choices_docstring
|
308
|
-
>>> install.__doc__ += _choices_docstring('install')
|
309
|
-
|
310
|
-
"""
|
311
|
-
options_str = f"\n Options:\n `{action} "
|
312
|
-
subactions = _get_subaction_names(action, globs=globs)
|
313
|
-
options_str += "["
|
314
|
-
sa_names = []
|
315
|
-
for sa in subactions:
|
316
|
-
try:
|
317
|
-
sa_names.append(sa.__name__[len(f"_{action}") + 1:])
|
318
|
-
except Exception as e:
|
319
|
-
print(e)
|
320
|
-
return ""
|
321
|
-
for sa_name in sorted(sa_names):
|
322
|
-
options_str += f"{sa_name}, "
|
323
|
-
options_str = options_str[:-2] + "]`"
|
324
|
-
return options_str
|
325
|
-
|
326
|
-
|
327
|
-
def print_options(
|
328
|
-
options: Optional[Dict[str, Any]] = None,
|
329
|
-
nopretty: bool = False,
|
330
|
-
no_rich: bool = False,
|
331
|
-
name: str = 'options',
|
332
|
-
header: Optional[str] = None,
|
333
|
-
num_cols: Optional[int] = None,
|
334
|
-
adjust_cols: bool = True,
|
335
|
-
**kw
|
336
|
-
) -> None:
|
337
|
-
"""
|
338
|
-
Print items in an iterable as a fancy table.
|
339
|
-
|
340
|
-
Parameters
|
341
|
-
----------
|
342
|
-
options: Optional[Dict[str, Any]], default None
|
343
|
-
The iterable to be printed.
|
344
|
-
|
345
|
-
nopretty: bool, default False
|
346
|
-
If `True`, don't use fancy formatting.
|
347
|
-
|
348
|
-
no_rich: bool, default False
|
349
|
-
If `True`, don't use `rich` to format the output.
|
350
|
-
|
351
|
-
name: str, default 'options'
|
352
|
-
The text in the default header after `'Available'`.
|
353
|
-
|
354
|
-
header: Optional[str], default None
|
355
|
-
If provided, override `name` and use this as the header text.
|
356
|
-
|
357
|
-
num_cols: Optional[int], default None
|
358
|
-
How many columns in the table. Depends on the terminal size. If `None`, use 8.
|
359
|
-
|
360
|
-
adjust_cols: bool, default True
|
361
|
-
If `True`, adjust the number of columns depending on the terminal size.
|
362
|
-
|
363
|
-
"""
|
364
|
-
import os
|
365
|
-
from meerschaum.utils.packages import import_rich
|
366
|
-
from meerschaum.utils.formatting import make_header, highlight_pipes
|
367
|
-
from meerschaum.actions import actions as _actions
|
368
|
-
|
369
|
-
|
370
|
-
if options is None:
|
371
|
-
options = {}
|
372
|
-
_options = []
|
373
|
-
for o in options:
|
374
|
-
_options.append(str(o))
|
375
|
-
_header = f"Available {name}" if header is None else header
|
376
|
-
|
377
|
-
if num_cols is None:
|
378
|
-
num_cols = 8
|
379
|
-
|
380
|
-
def _print_options_no_rich():
|
381
|
-
if not nopretty:
|
382
|
-
print()
|
383
|
-
print(make_header(_header))
|
384
|
-
### print actions
|
385
|
-
for option in sorted(_options):
|
386
|
-
if not nopretty:
|
387
|
-
print(" - ", end="")
|
388
|
-
print(option)
|
389
|
-
if not nopretty:
|
390
|
-
print()
|
391
|
-
|
392
|
-
rich = import_rich()
|
393
|
-
if rich is None or nopretty or no_rich:
|
394
|
-
_print_options_no_rich()
|
395
|
-
return None
|
396
|
-
|
397
|
-
### Prevent too many options from being truncated on small terminals.
|
398
|
-
if adjust_cols and _options:
|
399
|
-
_cols, _lines = get_cols_lines()
|
400
|
-
while num_cols > 1:
|
401
|
-
cell_len = int(((_cols - 4) - (3 * (num_cols - 1))) / num_cols)
|
402
|
-
num_too_big = sum([(1 if string_width(o) > cell_len else 0) for o in _options])
|
403
|
-
if num_too_big > int(len(_options) / 3):
|
404
|
-
num_cols -= 1
|
405
|
-
continue
|
406
|
-
break
|
407
|
-
|
408
|
-
from meerschaum.utils.formatting import pprint, get_console
|
409
|
-
from meerschaum.utils.packages import attempt_import
|
410
|
-
rich_columns = attempt_import('rich.columns')
|
411
|
-
rich_panel = attempt_import('rich.panel')
|
412
|
-
rich_table = attempt_import('rich.table')
|
413
|
-
Text = attempt_import('rich.text').Text
|
414
|
-
box = attempt_import('rich.box')
|
415
|
-
Panel = rich_panel.Panel
|
416
|
-
Columns = rich_columns.Columns
|
417
|
-
Table = rich_table.Table
|
418
|
-
|
419
|
-
if _header is not None:
|
420
|
-
table = Table(
|
421
|
-
title = '\n' + _header,
|
422
|
-
box = box.SIMPLE,
|
423
|
-
show_header = False,
|
424
|
-
show_footer = False,
|
425
|
-
title_style = '',
|
426
|
-
expand = True,
|
427
|
-
)
|
428
|
-
else:
|
429
|
-
table = Table.grid(padding=(0, 2))
|
430
|
-
for i in range(num_cols):
|
431
|
-
table.add_column()
|
432
|
-
|
433
|
-
chunks = iterate_chunks(
|
434
|
-
[Text.from_ansi(highlight_pipes(o)) for o in sorted(_options)],
|
435
|
-
num_cols,
|
436
|
-
fillvalue=''
|
437
|
-
)
|
438
|
-
for c in chunks:
|
439
|
-
table.add_row(*c)
|
440
|
-
|
441
|
-
get_console().print(table)
|
442
|
-
return None
|
443
|
-
|
444
|
-
|
445
287
|
def get_cols_lines(default_cols: int = 100, default_lines: int = 120) -> Tuple[int, int]:
|
446
288
|
"""
|
447
289
|
Determine the columns and lines in the terminal.
|
@@ -658,7 +500,7 @@ def timed_input(
|
|
658
500
|
return input(prompt)
|
659
501
|
except TimeoutExpired:
|
660
502
|
return None
|
661
|
-
except EOFError:
|
503
|
+
except (EOFError, RuntimeError):
|
662
504
|
try:
|
663
505
|
print(prompt)
|
664
506
|
time.sleep(seconds)
|
@@ -1128,6 +970,7 @@ def async_wrap(func):
|
|
1128
970
|
return await loop.run_in_executor(executor, pfunc)
|
1129
971
|
return run
|
1130
972
|
|
973
|
+
|
1131
974
|
def debug_trace(browser: bool = True):
|
1132
975
|
"""
|
1133
976
|
Open a web-based debugger to trace the execution of the program.
|
@@ -1136,6 +979,7 @@ def debug_trace(browser: bool = True):
|
|
1136
979
|
heartrate = attempt_import('heartrate')
|
1137
980
|
heartrate.trace(files=heartrate.files.all, browser=browser)
|
1138
981
|
|
982
|
+
|
1139
983
|
def items_str(
|
1140
984
|
items: List[Any],
|
1141
985
|
quotes: bool = True,
|
@@ -1224,6 +1068,29 @@ def items_str(
|
|
1224
1068
|
return output
|
1225
1069
|
|
1226
1070
|
|
1071
|
+
def interval_str(delta: Union[timedelta, int]) -> str:
|
1072
|
+
"""
|
1073
|
+
Return a human-readable string for a `timedelta` (or `int` minutes).
|
1074
|
+
|
1075
|
+
Parameters
|
1076
|
+
----------
|
1077
|
+
delta: Union[timedelta, int]
|
1078
|
+
The interval to print. If `delta` is an integer, assume it corresponds to minutes.
|
1079
|
+
|
1080
|
+
Returns
|
1081
|
+
-------
|
1082
|
+
A formatted string, fit for human eyes.
|
1083
|
+
"""
|
1084
|
+
from meerschaum.utils.packages import attempt_import
|
1085
|
+
humanfriendly = attempt_import('humanfriendly')
|
1086
|
+
delta_seconds = (
|
1087
|
+
delta.total_seconds()
|
1088
|
+
if isinstance(delta, timedelta)
|
1089
|
+
else (delta * 60)
|
1090
|
+
)
|
1091
|
+
return humanfriendly.format_timespan(delta_seconds)
|
1092
|
+
|
1093
|
+
|
1227
1094
|
def is_docker_available() -> bool:
|
1228
1095
|
"""Check if we can connect to the Docker engine."""
|
1229
1096
|
import subprocess
|
@@ -1518,3 +1385,132 @@ def safely_extract_tar(tarf: 'file', output_dir: Union[str, 'pathlib.Path']) ->
|
|
1518
1385
|
tar.extractall(path=path, members=members, numeric_owner=numeric_owner)
|
1519
1386
|
|
1520
1387
|
return safe_extract(tarf, output_dir)
|
1388
|
+
|
1389
|
+
##################
|
1390
|
+
# Legacy imports #
|
1391
|
+
##################
|
1392
|
+
|
1393
|
+
def choose_subaction(*args, **kwargs) -> Any:
|
1394
|
+
"""
|
1395
|
+
Placeholder function to prevent breaking legacy behavior.
|
1396
|
+
See `meerschaum.actions.choose_subaction`.
|
1397
|
+
"""
|
1398
|
+
from meerschaum.actions import choose_subaction as _choose_subactions
|
1399
|
+
return _choose_subactions(*args, **kwargs)
|
1400
|
+
|
1401
|
+
|
1402
|
+
def print_options(*args, **kwargs) -> None:
|
1403
|
+
"""
|
1404
|
+
Placeholder function to prevent breaking legacy behavior.
|
1405
|
+
See `meerschaum.utils.formatting.print_options`.
|
1406
|
+
"""
|
1407
|
+
from meerschaum.utils.formatting import print_options as _print_options
|
1408
|
+
return _print_options(*args, **kwargs)
|
1409
|
+
|
1410
|
+
|
1411
|
+
def to_pandas_dtype(*args, **kwargs) -> Any:
|
1412
|
+
"""
|
1413
|
+
Placeholder function to prevent breaking legacy behavior.
|
1414
|
+
See `meerschaum.utils.dtypes.to_pandas_dtype`.
|
1415
|
+
"""
|
1416
|
+
from meerschaum.utils.dtypes import to_pandas_dtype as _to_pandas_dtype
|
1417
|
+
return _to_pandas_dtype(*args, **kwargs)
|
1418
|
+
|
1419
|
+
|
1420
|
+
def filter_unseen_df(*args, **kwargs) -> Any:
|
1421
|
+
"""
|
1422
|
+
Placeholder function to prevent breaking legacy behavior.
|
1423
|
+
See `meerschaum.utils.dataframe.filter_unseen_df`.
|
1424
|
+
"""
|
1425
|
+
from meerschaum.utils.dataframe import filter_unseen_df as real_function
|
1426
|
+
return real_function(*args, **kwargs)
|
1427
|
+
|
1428
|
+
|
1429
|
+
def add_missing_cols_to_df(*args, **kwargs) -> Any:
|
1430
|
+
"""
|
1431
|
+
Placeholder function to prevent breaking legacy behavior.
|
1432
|
+
See `meerschaum.utils.dataframe.add_missing_cols_to_df`.
|
1433
|
+
"""
|
1434
|
+
from meerschaum.utils.dataframe import add_missing_cols_to_df as real_function
|
1435
|
+
return real_function(*args, **kwargs)
|
1436
|
+
|
1437
|
+
|
1438
|
+
def parse_df_datetimes(*args, **kwargs) -> Any:
|
1439
|
+
"""
|
1440
|
+
Placeholder function to prevent breaking legacy behavior.
|
1441
|
+
See `meerschaum.utils.dataframe.parse_df_datetimes`.
|
1442
|
+
"""
|
1443
|
+
from meerschaum.utils.dataframe import parse_df_datetimes as real_function
|
1444
|
+
return real_function(*args, **kwargs)
|
1445
|
+
|
1446
|
+
|
1447
|
+
def df_from_literal(*args, **kwargs) -> Any:
|
1448
|
+
"""
|
1449
|
+
Placeholder function to prevent breaking legacy behavior.
|
1450
|
+
See `meerschaum.utils.dataframe.df_from_literal`.
|
1451
|
+
"""
|
1452
|
+
from meerschaum.utils.dataframe import df_from_literal as real_function
|
1453
|
+
return real_function(*args, **kwargs)
|
1454
|
+
|
1455
|
+
|
1456
|
+
def get_json_cols(*args, **kwargs) -> Any:
|
1457
|
+
"""
|
1458
|
+
Placeholder function to prevent breaking legacy behavior.
|
1459
|
+
See `meerschaum.utils.dataframe.get_json_cols`.
|
1460
|
+
"""
|
1461
|
+
from meerschaum.utils.dataframe import get_json_cols as real_function
|
1462
|
+
return real_function(*args, **kwargs)
|
1463
|
+
|
1464
|
+
|
1465
|
+
def get_unhashable_cols(*args, **kwargs) -> Any:
|
1466
|
+
"""
|
1467
|
+
Placeholder function to prevent breaking legacy behavior.
|
1468
|
+
See `meerschaum.utils.dataframe.get_unhashable_cols`.
|
1469
|
+
"""
|
1470
|
+
from meerschaum.utils.dataframe import get_unhashable_cols as real_function
|
1471
|
+
return real_function(*args, **kwargs)
|
1472
|
+
|
1473
|
+
|
1474
|
+
def enforce_dtypes(*args, **kwargs) -> Any:
|
1475
|
+
"""
|
1476
|
+
Placeholder function to prevent breaking legacy behavior.
|
1477
|
+
See `meerschaum.utils.dataframe.enforce_dtypes`.
|
1478
|
+
"""
|
1479
|
+
from meerschaum.utils.dataframe import enforce_dtypes as real_function
|
1480
|
+
return real_function(*args, **kwargs)
|
1481
|
+
|
1482
|
+
|
1483
|
+
def get_datetime_bound_from_df(*args, **kwargs) -> Any:
|
1484
|
+
"""
|
1485
|
+
Placeholder function to prevent breaking legacy behavior.
|
1486
|
+
See `meerschaum.utils.dataframe.get_datetime_bound_from_df`.
|
1487
|
+
"""
|
1488
|
+
from meerschaum.utils.dataframe import get_datetime_bound_from_df as real_function
|
1489
|
+
return real_function(*args, **kwargs)
|
1490
|
+
|
1491
|
+
|
1492
|
+
def df_is_chunk_generator(*args, **kwargs) -> Any:
|
1493
|
+
"""
|
1494
|
+
Placeholder function to prevent breaking legacy behavior.
|
1495
|
+
See `meerschaum.utils.dataframe.df_is_chunk_generator`.
|
1496
|
+
"""
|
1497
|
+
from meerschaum.utils.dataframe import df_is_chunk_generator as real_function
|
1498
|
+
return real_function(*args, **kwargs)
|
1499
|
+
|
1500
|
+
|
1501
|
+
def choices_docstring(*args, **kwargs) -> Any:
|
1502
|
+
"""
|
1503
|
+
Placeholder function to prevent breaking legacy behavior.
|
1504
|
+
See `meerschaum.actions.choices_docstring`.
|
1505
|
+
"""
|
1506
|
+
from meerschaum.actions import choices_docstring as real_function
|
1507
|
+
return real_function(*args, **kwargs)
|
1508
|
+
|
1509
|
+
|
1510
|
+
def _get_subaction_names(*args, **kwargs) -> Any:
|
1511
|
+
"""
|
1512
|
+
Placeholder function to prevent breaking legacy behavior.
|
1513
|
+
See `meerschaum.actions._get_subaction_names`.
|
1514
|
+
"""
|
1515
|
+
from meerschaum.actions import _get_subaction_names as real_function
|
1516
|
+
return real_function(*args, **kwargs)
|
@@ -1292,7 +1292,7 @@ def import_pandas(
|
|
1292
1292
|
(
|
1293
1293
|
"You are using an alternative Pandas implementation "
|
1294
1294
|
+ f"'{pandas_module_name}'"
|
1295
|
-
+ "\
|
1295
|
+
+ "\n Features may not work as expected."
|
1296
1296
|
),
|
1297
1297
|
stack = False,
|
1298
1298
|
)
|
@@ -121,6 +121,7 @@ packages: Dict[str, Dict[str, str]] = {
|
|
121
121
|
packages['sql'] = {
|
122
122
|
'numpy' : 'numpy>=1.18.5',
|
123
123
|
'pandas' : 'pandas[parquet]>=2.0.1',
|
124
|
+
'pyarrow' : 'pyarrow>=7.0.0',
|
124
125
|
'dask' : 'dask>=2023.9.0',
|
125
126
|
'pytz' : 'pytz',
|
126
127
|
'joblib' : 'joblib>=0.17.0',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: meerschaum
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.0rc9
|
4
4
|
Summary: Sync Time-Series Pipes with Meerschaum
|
5
5
|
Home-page: https://meerschaum.io
|
6
6
|
Author: Bennett Meares
|
@@ -70,6 +70,7 @@ Requires-Dist: pydantic (>=1.7.4) ; extra == 'api'
|
|
70
70
|
Requires-Dist: httpx (>=0.24.1) ; extra == 'api'
|
71
71
|
Requires-Dist: numpy (>=1.18.5) ; extra == 'api'
|
72
72
|
Requires-Dist: pandas[parquet] (>=2.0.1) ; extra == 'api'
|
73
|
+
Requires-Dist: pyarrow (>=7.0.0) ; extra == 'api'
|
73
74
|
Requires-Dist: dask (>=2023.9.0) ; extra == 'api'
|
74
75
|
Requires-Dist: pytz ; extra == 'api'
|
75
76
|
Requires-Dist: joblib (>=0.17.0) ; extra == 'api'
|
@@ -232,6 +233,7 @@ Requires-Dist: pywebview (>=3.6.3) ; extra == 'full'
|
|
232
233
|
Requires-Dist: pycparser (>=2.21.0) ; extra == 'full'
|
233
234
|
Requires-Dist: numpy (>=1.18.5) ; extra == 'full'
|
234
235
|
Requires-Dist: pandas[parquet] (>=2.0.1) ; extra == 'full'
|
236
|
+
Requires-Dist: pyarrow (>=7.0.0) ; extra == 'full'
|
235
237
|
Requires-Dist: dask (>=2023.9.0) ; extra == 'full'
|
236
238
|
Requires-Dist: pytz ; extra == 'full'
|
237
239
|
Requires-Dist: joblib (>=0.17.0) ; extra == 'full'
|
@@ -270,6 +272,7 @@ Provides-Extra: setup
|
|
270
272
|
Provides-Extra: sql
|
271
273
|
Requires-Dist: numpy (>=1.18.5) ; extra == 'sql'
|
272
274
|
Requires-Dist: pandas[parquet] (>=2.0.1) ; extra == 'sql'
|
275
|
+
Requires-Dist: pyarrow (>=7.0.0) ; extra == 'sql'
|
273
276
|
Requires-Dist: dask (>=2023.9.0) ; extra == 'sql'
|
274
277
|
Requires-Dist: pytz ; extra == 'sql'
|
275
278
|
Requires-Dist: joblib (>=0.17.0) ; extra == 'sql'
|