| 347 | |
| 348 | |
| 349 | def _get_parser(): |
| 350 | parser = argparse.ArgumentParser( |
| 351 | description=( |
| 352 | "This utility is very powerful and lets you copy any " |
| 353 | "leaf, group or complete subtree into another file. " |
| 354 | "During the copy process you are allowed to change the filter " |
| 355 | "properties if you want so. Also, in the case of duplicated " |
| 356 | "pathnames, you can decide if you want to overwrite already " |
| 357 | "existing nodes on the destination file. Generally speaking, " |
| 358 | "ptrepack can be useful in may situations, like replicating a " |
| 359 | "subtree in another file, change the filters in objects and see " |
| 360 | "how affect this to the compression degree or I/O performance, " |
| 361 | "consolidating specific data in repositories or even *importing* " |
| 362 | "generic HDF5 files and create true PyTables counterparts." |
| 363 | ) |
| 364 | ) |
| 365 | |
| 366 | parser.add_argument( |
| 367 | "-v", |
| 368 | "--verbose", |
| 369 | action="store_true", |
| 370 | help="show verbose information", |
| 371 | ) |
| 372 | parser.add_argument( |
| 373 | "-o", |
| 374 | "--overwrite", |
| 375 | action="store_true", |
| 376 | dest="overwritefile", |
| 377 | help="overwrite destination file", |
| 378 | ) |
| 379 | parser.add_argument( |
| 380 | "-R", |
| 381 | "--range", |
| 382 | dest="rng", |
| 383 | metavar="RANGE", |
| 384 | help=( |
| 385 | "select a RANGE of rows (in the form 'start,stop,step') " |
| 386 | "during the copy of *all* the leaves. " |
| 387 | "Default values are 'None, None, 1', which means a copy of all " |
| 388 | "the rows." |
| 389 | ), |
| 390 | ) |
| 391 | parser.add_argument( |
| 392 | "--non-recursive", |
| 393 | action="store_false", |
| 394 | default=True, |
| 395 | dest="recursive", |
| 396 | help="do not do a recursive copy. Default is to do it", |
| 397 | ) |
| 398 | parser.add_argument( |
| 399 | "--dest-title", |
| 400 | dest="title", |
| 401 | default="", |
| 402 | help="title for the new file (if not specified, the source is copied)", |
| 403 | ) |
| 404 | parser.add_argument( |
| 405 | "--dont-create-sysattrs", |
| 406 | action="store_false", |