MCPcopy Create free account
hub / github.com/PyTables/PyTables / main

Function main

tables/scripts/ptrepack.py:572–775  ·  view source on GitHub ↗

Implement the main CLI interface.

()

Source from the content-addressed store, hash-verified

570
571
572def main():
573 """Implement the main CLI interface."""
574 global verbose
575 global regoldindexes
576 global createsysattrs
577
578 parser = _get_parser()
579 args = parser.parse_args()
580
581 # check arguments
582 if args.rng:
583 try:
584 args.rng = eval("slice(" + args.rng + ")")
585 except Exception:
586 parser.error("Error when getting the range parameter.")
587
588 if args.chunkshape.isdigit() or args.chunkshape.startswith("("):
589 args.chunkshape = eval(args.chunkshape)
590
591 if args.complevel < 0 or args.complevel > 9:
592 parser.error(
593 'invalid "complevel" value, it sould be in te range [0, 9]'
594 )
595
596 # Catch the files passed as the last arguments
597 src = args.src.rsplit(":", 1)
598 dst = args.dst.rsplit(":", 1)
599 if len(src) == 1:
600 srcfile, srcnode = src[0], "/"
601 else:
602 srcfile, srcnode = src
603 if len(dst) == 1:
604 dstfile, dstnode = dst[0], "/"
605 else:
606 dstfile, dstnode = dst
607
608 if srcnode == "":
609 # case where filename == "filename:" instead of "filename:/"
610 srcnode = "/"
611
612 if dstnode == "":
613 # case where filename == "filename:" instead of "filename:/"
614 dstnode = "/"
615
616 # Ignore the warnings for tables that contains oldindexes
617 # (these will be handled by the copying routines)
618 warnings.filterwarnings("ignore", category=tb.exceptions.OldIndexWarning)
619
620 # Ignore the flavors warnings during upgrading flavor operations
621 if args.upgradeflavors:
622 warnings.filterwarnings("ignore", category=tb.exceptions.FlavorWarning)
623
624 # Build the Filters instance
625 filter_params = (
626 args.complevel,
627 args.complib,
628 args.shuffle,
629 args.bitshuffle,

Callers

nothing calls this directly

Calls 5

copy_childrenFunction · 0.85
copy_leafFunction · 0.85
_get_parserFunction · 0.70
get_nodeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected