Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
choices=['hoomd', 'none'],
help="The file schema.")
parser_read.add_argument(
'-m',
'--mode',
type=str,
default='rb',
choices=['rb', 'rb+', 'wb', 'wb+', 'xb', 'xb+', 'ab'],
help="The file mode.")
parser_read.set_defaults(func=main_read)
# This is a hack, as argparse itself does not
# allow to parse only --version without any
# of the other required arguments.
if '--version' in sys.argv:
print('gsd', __version__)
sys.exit(0)
args = parser.parse_args()
if not hasattr(args, 'func'):
parser.print_usage()
sys.exit(2)
try:
args.func(args)
except KeyboardInterrupt:
_print_err()
_print_err("Interrupted.")
if args.debug:
raise
sys.exit(1)
except RuntimeWarning as warning:
})
attributes.update({"Number of frames": len(traj)})
else:
if args.mode not in ['rb', 'rb+', 'ab']:
raise ValueError("Unsupported schema for creating a file.")
handle = fl.open(args.file, args.mode)
local_ns.update({
'handle': handle,
})
extras = "\n".join(
"{}: {}".format(key, val) for key, val in attributes.items())
code.interact(local=local_ns,
banner=SHELL_BANNER.format(python_version=sys.version,
gsd_version=__version__,
fn=args.file,
extras=extras + "\n"))